jjzjj

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

coder 2023-09-21 原文

我一直在使用 AFNetworking 开发 xcode 5.0.2,一切都很完美。 当我升级到 xcode 6 GM 时,我收到了警告:

@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];
}

我找到了 this answer在 SO 上并下载了 xcode 5.1.1 按照建议复制库将基本 sdk 设置为 7.1 并且错误仍然存​​在

有什么建议吗?

最佳答案

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

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

@synthesize cancelled = _cancelled;

关于ios - @property (readwrite, nonatomic, assign, getter = isCancelled) BOOL 取消 - xcode6 导致编译器错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25840294/

有关ios - @property (readwrite, nonatomic, assign, getter = isCancelled) BOOL 取消 - xcode6 导致编译器错误的更多相关文章

  1. Ruby Koans about_array_assignment - 非平行与平行分配歧视 - 2

    通过ruby​​koans.com,我在about_array_assignment.rb中遇到了这两段代码你怎么知道第一个是非并行赋值,第二个是一个变量的并行赋值?在我看来,除了命名差异之外,代码几乎完全相同。4deftest_non_parallel_assignment5names=["John","Smith"]6assert_equal["John","Smith"],names7end45deftest_parallel_assignment_with_one_variable46first_name,=["John","Smith"]47assert_equal'John

  2. ruby - 如何在 Lion 上安装 Xcode 4.6,需要用 RVM 升级 ruby - 2

    我实际上是在尝试使用RVM在我的OSX10.7.5上更新ruby,并在输入以下命令后:rvminstallruby我得到了以下回复:Searchingforbinaryrubies,thismighttakesometime.Checkingrequirementsforosx.Installingrequirementsforosx.Updatingsystem.......Errorrunning'requirements_osx_brew_update_systemruby-2.0.0-p247',pleaseread/Users/username/.rvm/log/138121

  3. ruby - 怎么来的(a_method || :other) returns :other only when assigning to a var called a_method? - 2

    给定以下方法:defsome_method:valueend以下语句按我的预期工作:some_method||:other#=>:valuex=some_method||:other#=>:value但是下面语句的行为让我感到困惑:some_method=some_method||:other#=>:other它按预期创建了一个名为some_method的局部变量,随后对some_method的调用返回该局部变量的值。但为什么它分配:other而不是:value呢?我知道这可能不是一件明智的事情,并且可以看出它可能有多么模棱两可,但我认为应该在考虑作业之前评估作业的右侧...我已经在R

  4. ruby-on-rails - "assigns"在 Ruby on Rails 中有什么作用? - 2

    我目前正在尝试学习RubyonRails和测试框架RSpec。assigns在此RSpec测试中做什么?describe"GETindex"doit"assignsallmymodelas@mymodel"domymodel=Factory(:mymodel)get:indexassigns(:mymodels).shouldeq([mymodel])endend 最佳答案 assigns只是检查您在Controller中设置的实例变量的值。这里检查@mymodels。 关于ruby-o

  5. ruby - Ruby 中的 bool 方法? - 2

    为了问这样的问题:MyClass::create().empty?如何在MyClass中设置empty?Empty(true/false)取决于类变量@arr是否为空。 最佳答案 问号实际上是方法名称的一部分,因此您可以这样做:classMyClassdefempty?@arr.empty?#Implicitlyreturned.endend 关于ruby-Ruby中的bool方法?,我们在StackOverflow上找到一个类似的问题: https://st

  6. .net - 是否有 Ruby .NET 编译器? - 2

    是否有适用于Ruby语言的.NETFramework编译器?我听说过DLR(动态语言运行时),这是否将使Ruby能够用于.NET开发? 最佳答案 IronRuby是Microsoft支持的项目,建立在动态语言运行时之上。 关于.net-是否有Ruby.NET编译器?,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/199638/

  7. ruby-on-rails - 如何使用 Xcode 4.5.1 在 OSX Lion 10.8.2 上编译 EventMachine gem - 2

    我找遍了所有我能找到的地方,但似乎找不到解决这个问题的办法。我在Lion10.8.2上使用Xcode4.5.1,并尝试为Rails项目运行bundle,但它一直卡在这上面。我正在为Heroku使用Thingem。Bolanos@Jeremys-Mac-mini⦿-1.9.3fishfarm$sudogeminstalleventmachinePassword:Buildingnativeextensions.Thiscouldtakeawhile...ERROR:Errorinstallingeventmachine:ERROR:Failedtobuildgemnativeextens

  8. ruby - @property 或 self.property 使用访问器设置属性? - 2

    哪个是更好的做法;通过@property或self.property使用访问器操作属性? 最佳答案 如果您只是使用直接访问器,那么请坚持使用@property(除非您来自Python并且被@sigilhehe关闭)否则:这完全取决于您。但是self.property在某些需要确保属性已初始设置的情况下很有用:defproperty@property||=[]end#don'tneedtocheckif@propertyis`nil`firstself.property另请注意,在@property上使用self.property会产

  9. ruby-on-rails - Rails 查询 : Filter by properties in another table - 2

    我正在寻找一个清晰的Rails4示例,说明如何根据通过另一个表关联的数据过滤记录。假设我有一个用户模型和一个评论模型。一个用户has_many评论,一个Commentbelongs_to一个用户。评论在其表中也有一个score列。classUserUsers|id|name|email||-----|---------|---------------------||1|"Alice"|"alice@example.com"||2|"Bob"|"bob@example.com"||...|classComment我如何获得所有对内容“k”发表评论且分数>0的用户?请注意,我要返回的是用户

  10. Ruby Compass 编译器不工作,在线错误 [54] - 2

    RubyCompass不工作,代码如下,我已经在网上尝试了10-20种方法,有什么建议吗?在屏幕截图中,您会找到一种更简单的方法来读取我的gem的终端转储和错误,如果您想从那里获取一些东西,您会在屏幕截图下方找到文本谢谢,干杯,罗伯特RubyGemsisasophisticatedpackagemanagerforRuby.Thisisabasichelpmessagecontainingpointerstomoreinformation.Usage:gem-h/--helpgem-v/--versiongemcommand[arguments...][options...]Examp

随机推荐