Saturday, March 14, 2009

Unable to read symbols for "/System/Library/Frameworks/UIKit.framework/UIKit"

So you've been playing the XCode and wrapping your head round Cocoa and the Interface Builder, and then you make one inconsequential change, and your whole world falls apart: instead of the gloriously lickable application appearing in the iPhone simulator, the simulator launches and then closes, and XCode reports __TERMINATING_DUE_TO_UNCAUGHT_EXCEPTION__. When you open the debugger window, you see a worrying set of messages such as: 

warning: Unable to read symbols for "/System/Library/Frameworks/UIKit.framework/UIKit" (file not found).
warning: Unable to read symbols from "UIKit" (not yet mapped into memory).
warning: Unable to read symbols for "/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics" (file not found).
warning: Unable to read symbols from "CoreGraphics" (not yet mapped into memory).

"What the hell did I do? I deleted my frameworks?? How???" may be the thoughts going through your head right now - but don't worry! All that is happening is the the gdb debugger is looking in the wrong place for the iPhoneOS frameworks; it's looking in the MacOS framework directory /System/Library/Frameworks instead of the iPhoneOS directory which would be something like /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.2.1.sdk/System/Library/Frameworks/CoreGraphics.framewor. Unfortunately, these messages take up most of the space on the default tiny gdb window, so the error that caused gdb to be launched has scrolled off the top of the screen. If you scroll up, you'll find the real error that your minor change caused.

I've not found a clear explanation why gdb is using the wrong path, or how to correct this, but if you're desperate to suppress these messages, you can set up symbolic links to the appropriate frameworks e.g.
sudo ln -s /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.2.1.sdk/System/Library/Frameworks/UIKit.framework/  /System/Library/Frameworks/UIKit.framework 

If anyone knows how to fix gdb's path information, please let me know.

No comments:

Post a Comment