首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >@property (读写,非原子,赋值,getter = isCancelled) BOOL已取消- xcode6导致编译器错误

@property (读写,非原子,赋值,getter = isCancelled) BOOL已取消- xcode6导致编译器错误
EN

Stack Overflow用户
提问于 2014-09-15 11:04:36
回答 1查看 2.7K关注 0票数 8

我一直在用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

代码语言:javascript
复制
@property (readwrite, nonatomic, assign, getter = isCancelled) BOOL cancelled

和错误:Use of undeclared identifier '_cancelled'

代码语言:javascript
复制
- (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,但错误仍然存在

有什么建议吗?

EN

回答 1

Stack Overflow用户

发布于 2014-10-04 05:41:33

NSOperation更改了几个属性的读取访问器名称,取消了-> isCancelled并完成了-> isFinished (我想)。以前它们是方法,但现在它们是属性。

AFNetworking需要更新到具有固定合成的版本。AFURLConnectionOperation.m文件现在具有以下修复此问题的功能。

代码语言:javascript
复制
@synthesize cancelled = _cancelled;
票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/25840294

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档