[Solved-4 Solutions] Undefined symbols for architecture i386: _OBJC_CLASS_$_SKPSMTPMessage", referenced from: error



Error Description:

  • When we import framework for sending email from application in background i.e. SKPSMTPMessageFramework. 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
click below button to copy the code. By - iOS tutorial - team

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

Solution 1:

  • 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

Solution 2:

  • Check the Valid Architectures & Build Active Architecture only properties.

Solution 3:

  • If you are using cocoapods make sure your target's build settings contain $(inherited) in the other linker flags section

Solution 4:

  • If you importing some other project in xcode and if current and import project both have same files in Compiler source then just remove same file in current project in "Build phase' settings.

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