30

First off, I'm using XCode 4.0.2.

Okay, here is my issue. I can build Apple sample program for MFMailComposerViewController and run it in the simulator (I am aware it will not send email, I'm just concerned that it builds). That seems to work fine.

HOWEVER, when I try to build in my application I get the following message.

ld: warning: ignoring file /Users/lloyd/Projects/iOS/simpleApp/MessageUI.framework/MessageUI, 
    missing required architecture i386 in file
    Undefined symbols for architecture i386: "_OBJC_CLASS_$_MFMailComposeViewController", referenced from:
  objc-class-ref in MailData.o
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status

SOLUTION

Looking "Build Settings" (Basic and Combined) I saw that I had "Framework Search Path" set. This was odd because I never remembered setting that. Deleting it fixed the problem.

I am now able to build for both the simulator and the target. NOTE: You can NOT send email from the simulator, but you should still be able to run the code (if that makes sense).

Dennis
  • 14,264
  • 2
  • 48
  • 57
Feloneous Cat
  • 895
  • 1
  • 8
  • 15

4 Answers4

88

In Xcode go to the build phases tab for your target. Make sure you see MessageUI.framework. If it's not there click + to add a new framework.

SpaceTrucker
  • 1,168
  • 7
  • 16
  • 1
    MessageUI.framework was part of the build - see above where I have the "SOLUTION". – Feloneous Cat Sep 22 '11 at 13:51
  • 2
    I realize this is an old question, but for others who come along from a web search, the issue might be that you have multiple targets and you forgot to add the framework to all of them. That happened to me. – Matt Long Mar 09 '12 at 00:45
4

SOLUTION

Looking "Build Settings" (Basic and Combined) I saw that I had "Framework Search Path" set. This was odd because I never remembered setting that. Deleting it fixed the problem.

I am now able to build for both the simulator and the target. NOTE: You can NOT send email from the simulator, but you should still be able to run the code (if that makes sense).

This was the solution to my problem :)

Feloneous Cat
  • 895
  • 1
  • 8
  • 15
  • THAAAAANKK YOUUUU, i was going mad, but I think I know now why it happened, I was draging and dropping frameworks from another project to this one... – AntonijoDev Nov 28 '13 at 08:18
2

Add MessageUI.framework although the docs said it is not a must.

gtrig
  • 12,550
  • 5
  • 28
  • 36
1

Add MessageUI.framework to the project Linked Frameworks and Libraries

Katta Nagarjuna
  • 1,539
  • 2
  • 12
  • 12