Undefined symbols for architecture i386: _OBJC_CLASS_$_SKPSMTPMessage", referenced from: error

Mann picture Mann · Aug 8, 2011 · Viewed 256.9k times · Source

I have imported framework for sending email from application in background i.e. SKPSMTPMessage Framework. Can somebody suggest why below error is shown

Undefined symbols for architecture i386:

"_OBJC_CLASS_$_SKPSMTPMessage", referenced from:
  objc-class-ref in ConfirmController.o

"_kSKPSMTPPartContentTransferEncodingKey", referenced from:
  -[ConfirmController sendEmail] in ConfirmController.o

"_kSKPSMTPPartMessageKey", referenced from:
  -[ConfirmController sendEmail] in ConfirmController.o

"_kSKPSMTPPartContentTypeKey", referenced from:
  -[ConfirmController sendEmail] in ConfirmController.o

ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status

Source from which framework is taken:-

Locking the Fields in MFMailComposeViewController

Update:

Answer:Just drag and drop folder over the project and click copy. Thats it select project check box and target check box as well.

Answer

Allen Pike picture Allen Pike · Feb 24, 2012

You can get this type of error if your class' .m file is not listed under the "Compile Sources" step of the "Build Phases" tab of your target. Normally Xcode does this for you, but sometimes it loses the plot and you need to add the .m file manually.

To do this:

TargetSettings -> Build Phases -> Compile Sources -> add your .m class ->Build and Run