YHNative_Message.m
1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//
// YHNative_Message.m
// YohoExplorerDemo
//
// Created by gaoqiang xu on 4/12/2015.
// Copyright © 2015 gaoqiang xu. All rights reserved.
//
#import "YHNative_Message.h"
NSString * const YHNative_Messenger = @"YHNativeMessage";
@implementation YHNative_Message
- (NSString *)actionName
{
return YHNative_Messenger;
}
- (void)handleMessage:(NSDictionary *)message {
self.successCallBack(nil, NO, message);
}
- (BOOL)respondsToSelector:(SEL)aSelector
{
return YES;
}
- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector
{
NSMethodSignature *signature = [super methodSignatureForSelector:aSelector];
if (!signature) {
return [self methodSignatureForSelector:@selector(handleMessage:)];
}
return signature;
}
- (void)forwardInvocation:(NSInvocation *)anInvocation
{
if ([YHNative instancesRespondToSelector:anInvocation.selector]) {
[super forwardInvocation:anInvocation];
} else {
[self handleMessage:self.originalParams];
}
}
@end