views:

3450

answers:

2

I've been fighting this framework error for days now. I have included the MessageUI framework from the iphone3.0sdk and imported the header file(MessageUI/MessageUI.h)

Anyone know what this error means?

collect2: ld returned 1 exit status
symbol(s) not found
literal-pointer@_OBJC@__cls_refs@MFMailComposeViewController 
".objc_class_name_MFMailComposeViewController", referenced from:

Here is some output from the build log:

ld warning: in /Users/me/iphone/myApp/MessageUI.framework/MessageUI, missing required architecture i386 in file
Undefined symbols:
  ".objc_class_name_MFMailComposeViewController", referenced from:
      literal-pointer@__OBJC@__cls_refs@MFMailComposeViewController in myViewController.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
+6  A: 

You forgot to link to the MessageUI.framework or you're linking to the wrong version.

Here's the right way to add frameworks:

  1. Double-click your target
  2. Select the main tab
  3. Add the framework by pressing the plus-button in the frameworks section

Now you should be able to build for the simulator and the device.

Edit:

The warning from ld looks like you copied the MessageUI.framework from the simulator SDK to your project directory. Delete it and ld should find the right one (the one in your current SDK).

Nikolai Ruhe
In his case, it sounds like he's linking against the device ARM framework, and not the i386 simulator version when he's building for the simulator. He should also check that the path type on the framework is "Relative to Current SDK".
Brad Larson
Tried adding the framework that way. Same error. Here's the path, relative to the SDK:/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/MessageUI.framework
sol
A: 

You accidentally copied the iPhone SDK Framework into your project directory (on disk). Open your project directory (where you keep the project on disk) and delete the iPhone SDK Framework directory.

Rebuild.

Jordan