Sep 15

A quick tip if you just upgraded to SDK 4.1 and are experiencing strange compilation errors with old projects.

The error may look something like this:

/Developer/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
   CFDataRef metadata) CG_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_0);
In file included from /Users/ab/project/project_Prefix.pch:7:

I’ve seen other variations as well, but they seem to stem from the Prefix.pch file, which you probably have not changed in a long time, if at all.

The solution is to update the iOS Deployment Target in your build settings. With SDK 4.1 Apple has helpfully removed the ability to select 2.x as a deployment target.


Just select iOS 3.0 or higher from the list, and your mysterious compilation errors should magically disappear.

Note: If you’re using the LLVM compiler and get a similar compilation error and the above solution does not work, check out this Developer Forum thread for a different solution. (That is from the iOS 4.1 Beta Forum, so you need to accept the new iOS Developer Program License Agreement before you can view it.)

written by Nick \\ tags:

Leave a Reply