@property(readwrite,nonatomic,assign,getter = isCancelled)BOOL取消 - xcode6导致编译错误

时间:2014-09-15 03:04:36

标签: ios xcode sdk

我一直在使用AFNetworking处理xco​​de 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并且错误仍然存​​在

有什么建议吗?

1 个答案:

答案 0 :(得分:4)

NSOperation更改了几个属性的读取访问者名称,取消了 - &gt; isCancelled and finished - &gt; isFinished(我想)。在他们成为方法之前,现在他们是属性。

AFNetworking需要更新为具有固定合成的版本。 AFURLConnectionOperation.m文件现在有以下内容来解决此问题。

@synthesize cancelled = _cancelled;
相关问题