升级到iOS 4.1 SDK后出现奇怪的问题

问题描述:

我已将iOS SDK升级到新发布的4.1,现在我在构建应用时出现以下错误:

I've upgraded the iOS SDK to the newly released 4.1 and now I have the following error while building my app:

/DeveloperBeta/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFContext.h:60:23     

/DeveloperBeta/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFContext.h:60:23: error: expected function body after function declarator

查看.h文件中的该行,我看到以下内容:

Looking at that line in the .h file I see the following:

CG_EXTERN void CGPDFContextAddDocumentMetadata(CGContextRef context, CFDataRef metadata) CG_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_0);

真正有趣的是定义__MAC_10_7似乎没有在任何地方定义。我在预编译应用程序的.pch文件时遇到此错误。

The really interesting thing is the define __MAC_10_7 which appears not to be defined anywhere. I get this error when pre-compiling the .pch file of my app.

一个简单的hello world应用程序编译有点奇怪。

What's curious is that a simple hello world app compiles.

我知道我该怎么办?

提前致谢!

Stelian

这是iOS 4.1 SDK的已知错误,并使用LLVM为iPhone模拟器构建。您可以在Apple的开发者论坛上的此主题中阅读所有相关内容。

This is a known bug with the iOS 4.1 SDK and building using LLVM for the iPhone Simulator. You can read all about it in this thread on Apple's Developer Forums.

推荐的解决方案是在项目的构建设置中将以下内容添加到其他C标志 -D__IPHONE_OS_VERSION_MIN_REQUIRED = 040100 您将部署目标版本替换为040100(例如,030000为3.0)。

The recommended solution is to add the following to Other C Flags in your project's build settings: -D__IPHONE_OS_VERSION_MIN_REQUIRED=040100 where you replace 040100 with your deployment target version (030000 for 3.0, for example).