Xcode Build and Analyze broken for simulator
Tuesday, October 5, 2010 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.
Reader Comments (1)
Ah. I was wondering what was going on. I've seen this message before, due to issues in the header file with explicitly declaring getters/setters in property declarations. But all of a sudden it was ubiquitous, and the detailed message was a joke. I couldn't figure out why it was suddenly happening yesterday, but now it make sense--I'd switched back to Simulator, after doing extensive testing on my iPhone.
Glad I found you. I can rest easier. I always assume I've screwed up somehow! Although I have had one bug report accepted by Apple this summer, and have another one I'm filing soon. So it can't always be me.... ;-)