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

我一直在使用AFNetworking处理xco​​de 5.0.2,一切都很完美.
当我升级到 xcode 6 GM时,我得到了警告:自动属性合成不会合成属性’已取消’,因为它是’readwrite’但它将通过此​​行上的另一个属性合成’readonly’:
@property (readwrite,nonatomic,assign,getter = isCancelled) BOOL cancelled

和错误:使用未声明的标识符’_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并且错误仍然存​​在

有什么建议?

解决方法

NSOperation更改了其几个属性的读取访问者名称,取消了 – > isCancelled and finished – > isFinished(我想).在他们成为方法之前,但现在他们是属性.

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

@synthesize cancelled = _cancelled;

相关文章

当我们远离最新的 iOS 16 更新版本时,我们听到了困扰 Apple...
欧版/美版 特别说一下,美版选错了 可能会永久丧失4G,不过只...
一般在接外包的时候, 通常第三方需要安装你的app进行测...
前言为了让更多的人永远记住12月13日,各大厂都在这一天将应...