2015-06-18
1
2
3
4
5
resolveInstanceMethod - nono
forwardingTargetForSelector - nono
methodSignatureForSelector - nono
forwardInvocation - nono
doesNotRecognizeSelector - nono

上の順で呼ばれるので必要なところに処理を入れる

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
@interface TestObject : NSObject
@end
@implementation TestObject
+ (BOOL)resolveInstanceMethod:(SEL)sel
{
NSLog(@"resolveInstanceMethod - %@", NSStringFromSelector(sel));
return [super resolveInstanceMethod:sel];
}
+ (BOOL)resolveClassMethod:(SEL)sel
{
NSLog(@"resolveClassMethod - %@", NSStringFromSelector(sel));
return [super resolveClassMethod:sel];
}
- (id)forwardingTargetForSelector:(SEL)sel
{
NSLog(@"forwardingTargetForSelector - %@", NSStringFromSelector(sel));
return [super forwardingTargetForSelector:sel];
}
- (NSMethodSignature *)methodSignatureForSelector:(SEL)sel
{
NSLog(@"methodSignatureForSelector - %@", NSStringFromSelector(sel));
NSString *types = @"@@:";
return [NSMethodSignature signatureWithObjCTypes:[types UTF8String]];
}
-(void)forwardInvocation:(NSInvocation *)invocation;
{
SEL sel = [invocation selector];
NSLog(@"forwardInvocation - %@", NSStringFromSelector(sel));
return [super forwardInvocation:invocation];
}
- (void)doesNotRecognizeSelector:(SEL)sel
{
NSLog(@"doesNotRecognizeSelector - %@", NSStringFromSelector(sel));
[super doesNotRecognizeSelector:sel];
}
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
TestObject *to = [TestObject new];
[to performSelector:NSSelectorFromString(@"nono")];
return YES;
}
@end
Share

Comments