问题描述
这在 Xcode 5 中编译/工作正常,但在 Xcode 6 Beta 4 中导致编译错误:
This compiles/works fine with Xcode 5, but causes a compile error with Xcode 6 Beta 4:
objc_msgSend(anItem.callback_object,
NSSelectorFromString(anItem.selector), dict);
这是一个3rd-party 组件,所以虽然我有源代码,但它并不是我的代码,我很犹豫要不要改变它(尽管我个人认为 'wtf 为什么是他们使用 objc_msgSend
??').
This is a 3rd-party component, so while I have the source code, it's not really my code and I'm hesitant to change it much (despite my personal opinion of 'wtf why are they using objc_msgSend
??').
带有可能有用细节的图像(错误浏览器中的错误):
Image with possibly useful detail (error in error browser):
推荐答案
我找到了答案,它在 2014 年 WWDCLLVM 中的新功能"的 Session 417 中.如果您在第 3 方库(例如 Apsalar)中找到此代码,则更新到最新版本可以修复它(可能是因为它不是作为 lib 分发的,哈哈).有关这些调用的转换示例,请参阅 THObserversAndBinders 库 - 我正在使用它并注意到作者更新了代码,例如:
I found the answer, and it's in Session 417 from 2014 WWDC "What's New in LLVM". If you find this code in a 3rd party library, such as Apsalar, updating to the latest version fixes it (probably because it's not distributed as a lib, ha). For an example of casting of these calls, see THObserversAndBinders library - I'm using it and noticed that the author updated the code, such as here:
https://github.com/th-in-gs/THObserversAndBinders/blob/master/THObserversAndBinders/THObserver.m
这篇关于函数调用的参数太多,预期为 0,有 3 个的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!