Xcode Build and Analyze broken for simulator

I did not notice this problem when I first upgraded to Xcode 3.2.4 and iOS 4.1 but it seems that the Build and Analyze function of Xcode is broken when the target is the Simulator. The problem is very easy to miss since it does not show as an error in the build log. If you are not paying attention you can end up thinking you have run the analyzer on your code without issues.

If however you keep a close eye on the build window or change the settings to show “All Messages” instead of “Issues Only” you will see some output complaining that “Analyzer skipped this file due to parse errors”

You can dig down further into the build logs which show a series of errors in various iPhoneSimulator4.1.sdk files:

In file included from /Developer/Platforms/iPhoneSimulator.platform/
Developer/SDKs/iPhoneSimulator4.1.sdk/System/Library/Frameworks/
CoreGraphics.framework/Headers/CoreGraphics.h:26:
/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);

This seems to be a known issue with the iOS 4.1 SDK when building for the simulator. The solution is simple enough - select a device as the target when using Build and Analyze. Hopefully this will get fixed with iOS 4.2.

Never miss a post

iOS Size Classes Cheat Sheet

Subscribe and also get my free iOS Size Classes Cheat Sheet

Success! Now check your email to confirm your subscription and download your free guide to iOS Size Classes.

There was an error submitting your subscription. Please try again.

Unsubscribe at any time. See Privacy Policy
No time to watch WWDC videos?

Sign up to get my iOS posts and news direct to your inbox and also get my free iOS Size Classes Cheat Sheet

OK! Check your inbox (or spam folder) for an email to confirm your details and download your free guide to iOS Size Classes.

There was an error submitting your subscription. Please try again.

Unsubscribe at any time. See Privacy Policy
Archives Categories