Search code examples
objective-cxcodeframeworksios-simulatorcore-text

CoreText Framework - App Won't Run in Simulator - iOS


I have an app which uses the CoreText framework. I am able to run the app successfully on the iPhone and iPad 1 and 2.

However I am unable to run the app in the xCode iPhone / iPad simulator. I am getting the following error message :

ld: warning: ignoring file /Users/croydonbod/Documents/iDevelopment/MyApp/CoreText.framework/CoreText, file was built for unsupported file format which is not the architecture being linked (i386)

Undefined symbols for architecture i386: "_CTFontCreateWithName", referenced from: -[View drawRect:] in View.o "_CTFramesetterCreateWithAttributedString", referenced from: -[View drawRect:] in View.o "_CTFramesetterCreateFrame", referenced from: -[View drawRect:] in View.o "_CTFrameGetVisibleStringRange", referenced from: -[View drawRect:] in View.o "_CTFrameDraw", referenced from: -[View drawRect:] in View.o "_kCTFontAttributeName", referenced from: -[View drawRect:] in View.o "_kCTForegroundColorAttributeName", referenced from: -[View drawRect:] in View.o ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation)

Can anyone suggest why this is happening ?

Thank you.


Solution

  • it looks like you copied the CoreText framework files from the SDK into your app instead of weak-linking the framework (which means the appropriate framework would load correctly for the device or for the simulator).

    Delete the CoreText framework from your project and re-add it, making sure to uncheck the "Copy items to destination folder" checkbox if it appears and once the CoreText framework is added, make certain the "Relative to SDK" Location is set for the CoreText framework in your project. Here is how it's set for the UIKit framework:

    enter image description here