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

前端之家收集整理的这篇文章主要介绍了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;
原文链接:https://www.f2er.com/iOS/333683.html

猜你在找的iOS相关文章