我一直在使用AFNetworking处理xcode 5.0.2,一切都运行得很好。
当我升级到xcode 6 GM时,我在这一行得到了警告: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并下载了xcode 5.1.1复制了库,就像建议将基本sdk设置为7.1并且错误仍然存在
有什么建议吗?
答案 0 :(得分:4)
NSOperation
更改了几个属性的读取访问者名称,取消了 - &gt; isCancelled and finished - &gt; isFinished(我想)。在他们成为方法之前,现在他们是属性。
AFNetworking
需要更新为具有固定合成的版本。 AFURLConnectionOperation.m文件现在有以下内容来解决此问题。
@synthesize cancelled = _cancelled;