我一直在用AFNetworking开发Xcode5.0.2,一切都运行得很好。当我升级到Xcode6GM时,我得到了下面这行的警告:Auto property synthesis will not synthesize property 'cancelled' because it is 'readwrite' but it will be synthesized 'readonly' via another property:
@property (readwrite, nonatomic, assign, getter = isCancelled) BOOL cancelled和错误:Use of undeclared identifier '_cancelled'
- (void)cancel {
[self.lock lock];
if (![self isFinished] && ![self isCancelled]) {
[self willChangeValueForKey:@"isCancelled"];
_cancelled = YES; <-- THIS LINE CAUSES THE ERROR
[super cancel];
[self didChangeValueForKey:@"isCancelled"];
// Cancel the connection on the thread it runs on to prevent race conditions
[self performSelector:@selector(cancelConnection) onThread:[[self class] networkRequestThread] withObject:nil waitUntilDone:NO modes:[self.runLoopModes allObjects]];
}
[self.lock unlock];
}我在SO上找到了this answer,并下载了Xcode5.1.1,按照建议复制库,将基础sdk设置为7.1,但错误仍然存在
有什么建议吗?
发布于 2014-10-04 05:41:33
NSOperation更改了几个属性的读取访问器名称,取消了-> isCancelled并完成了-> isFinished (我想)。以前它们是方法,但现在它们是属性。
AFNetworking需要更新到具有固定合成的版本。AFURLConnectionOperation.m文件现在具有以下修复此问题的功能。
@synthesize cancelled = _cancelled;https://stackoverflow.com/questions/25840294
复制相似问题