我有这样的代码:
NSInvocation* invocation = [NSInvocation invocationWithMethodSignature:[self methodSignatureForSelector:@selector(updateFrame)]];
[invocation setTarget:self];
[invocation setSelector:@selector(updateFrame)];
displayLink_ = [[CADisplayLink displayLinkWithTarget:invocation selector:@selector(invoke)] retain];
[displayLink_ setFrameInterval:1];
[displayLink_ addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
在 iOS 6.0(在 5.1 中,此代码工作正常),当此代码调用时我有两个变体:EXC_BAD_ACCESS 或'调用无法识别的选择器“调用”'。似乎 displayLinkWithTarget:selector: 方法不保留目标。当我添加 [invocation retain] 行时,代码可以正常工作。是iOS 6.0的bug吗?