MFMailComposeViewController doesn't link for s

2019-03-10 19:18发布

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).

4条回答
Rolldiameter
2楼-- · 2019-03-10 19:44

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.

查看更多
放我归山
3楼-- · 2019-03-10 19:48

Add MessageUI.framework to the project Linked Frameworks and Libraries

查看更多
Evening l夕情丶
4楼-- · 2019-03-10 19:54

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 :)

查看更多
你好瞎i
5楼-- · 2019-03-10 19:57

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

查看更多
登录 后发表回答