在静态库中,Xcode 8.1不会检测何时未实现Objective-C方法 [英] In a static library, Xcode 8.1 does not detect when an objective-c method is not implemented
问题描述
我的Objective-C项目使用一个静态库,最近我才发现Xcode 8.1并未对该库发出一些警告。
当应用程序本身缺少方法实现时,我会收到警告。但是,如果库中缺少方法实现,则不会收到任何警告。它只是在运行时崩溃。
My objective-c project uses a static library and recently I just discovered that Xcode 8.1 does not give some warnings for the library. When a method implementation is missing in the app itself, I get a warning. But if a method implementation is missing in the library, I get no warning. It just crashes at run time.
与带有枚举的switch语句相同。如果缺少某个案例,Xcode会发出警告,但不会在静态库中发出警告。
Same for the switch statement with an enum. If a case is missing, Xcode would signal a warning, but not in the static library.
在以前版本的Xcode中,我确定我在我的库中收到了这些警告。而且我从未更改任何构建设置,而只是保留所有默认值。
In previous versions of Xcode, I am sure I received those warnings in my library. And I never changed any Build Settings, I just keep all the default values.
更多信息:
当我将静态库本身作为项目打开时,会收到所有警告。但是,当我打开另一个包含库的项目时(我将mylibrary.xcodeproj文件拖放到了项目中,并在链接阶段添加了它),我没有库警告
When I open the static library itself as a project, I get all warnings. But when I open another project that includes the library (I dropped the mylibrary.xcodeproj file in my project and add it in the Link phase), I don't have the library warnings
推荐答案
这是Xcode中的错误。现在,它在Xcode 8.3版(8E162)中运行良好
It was a bug in Xcode. It is now working well in Xcode Version 8.3 (8E162)
这篇关于在静态库中,Xcode 8.1不会检测何时未实现Objective-C方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!