如何在 xcode iPhone 项目中启用代码块?
我正在尝试在我们的 iPhone 应用程序中启用代码块,以便我可以运行 xcode 中包含的静态分析器工具。当我运行构建和分析任务时,我收到此警告(或错误,具体取决于我使用的编译器):
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIView.h:252:72:错误:块支持已禁用 - 编译-fblocks 或选择支持它们的部署目标
我已将部署目标从 iPhone OS 3.0 更改为默认编译器,并将编译器从 GCC 4.2 更改为 LLVM 1.5 和 LLVM GCC 4.2,但没有成功。我不确定我还需要更改什么才能使这项工作正常进行,或者我需要在哪里添加 -fblocks 参数。有谁知道吗?
I'm trying to enable code blocks in our iphone application so that i can run the static analyzer tool included with xcode. I get this warning (or error, depending on which compiler i use) when i run the build and analyze task:
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIView.h:252:72: error: blocks support disabled - compile with -fblocks or pick a deployment target that supports them
I've changed my deployment target to compiler default from iPhone OS 3.0, and i've changed the compiler from GCC 4.2 to LLVM 1.5 and LLVM GCC 4.2 with no luck. I'm not sure what else I have to change to make this work, or where i need to add the -fblocks argument. Does anyone know?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 SDK 4.0 中,如果您使用包含块作为参数的新方法,则静态分析器将不起作用。您必须按如下方式显式启用块:在项目设置中,将
-fblocks
放入“Other C Flags
”设置中。In SDK 4.0, if you use the new methods including blocks as arguments, then the static analyzer does not work. You must explicitly enable blocks as follows: in your project's settings, put
-fblocks
in the "Other C Flags
" setting.