在xCode 5项目中使用iOS6 If Statement时构建错误 [英] Build error when using iOS6 If Statement in xCode 5 Project
问题描述
我正在使用Deployment Target 6.1和SDK 7.0在XCode 5中构建一个项目,但我在这一行收到错误:
I am building a project in XCode 5 with Deployment Target 6.1 and SDK 7.0 but I am getting an error on this line:
if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1) {
错误显示 *使用未声明的标识符'NSFoundationVersionNumber_iOS_6_1 *
推荐答案
您的代码应该可以在iOS7中使用。请再次交叉检查您的Base SDK版本。
Your code should work in iOS7. Please cross check your Base SDK version once again.
Project Target -->Build Settings -->Base SDk
它是 Foundation.framework
<$ c的一部分$ c> NSObjCRuntime.h class。因此,请确保项目目标 - >构建阶段 - >链接二进制文件库$ c $下的
Foundation.framework
c>部分。
Its a part of Foundation.framework
NSObjCRuntime.h
class. So make sure you have the Foundation.framework
under Project Target -->Build Phases -->Link Binary With Libraries
section.
如果不可用,请单击+按钮并将 Foundation.framework
添加到你的项目。
If it's not availabe, click on the + button and add the Foundation.framework
in to your project.
注意:
尝试运行时会发生这种情况在Xcode 4.x上为iOS 7 Base SDK构建的代码,或者如果您在Xcode 5中针对较旧的Base SDK进行编译。
This can happen when you try to run code built for iOS 7 Base SDK on Xcode 4.x, or if you compile against an older Base SDK in Xcode 5.
解决方案是定义什么不是使用宏手动定义。将此添加到每个抱怨的课程中,你应该没事。
The solution is to define what isn’t defined manually using a Macro. Add this to every class that’s complaining and you should be fine.
#ifndef NSFoundationVersionNumber_iOS_6_1
#define NSFoundationVersionNumber_iOS_6_1 993.00
#endif
这告诉编译器如果它不存在则定义值,所以它没有抱怨的理由。
This tells the compiler to define the value if it’s not there, so it has no reason to complain.
这篇关于在xCode 5项目中使用iOS6 If Statement时构建错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!