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

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.

The answer is


for me the issue turned out to be missing frameworks. Once I added em, it worked.


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. It worked for me.


You can get this type of error if you add third party libraries in your project that require native frameworks not included in your project.

You need to look inside the .h and .m files of your newly added library and see what frameworks it requires, then include those frameworks in your project (Target > Build Phases > Link Binary With Libraries).


Ran into a similar issue with IOS 6. Was able to solve it by adding storekit.framework to the "Link Binary with Libraries" in the build phases section.

Now, it works like a charm.


None of the above answer solved my issue. I got this same error when after I upgraded Xcode to 8, I went to Target --> Build Phases --> The Link Binary With Libraries and delete the framework that caused the problem and re added it and all the errors went away. Hope this will help others. enter image description here


In addition to what Allan did, adding missing classes, I followed @emdog4's solution and added the Core Data library by going to Build Phases in Xcode and under the 'Link Binary with Libraries' clicking on the + and selecting the 'CoreData.framework'. This sorted out my error


Check that all your bundle resources are copied in build phase.


In my case the pod update didn't update the project somehow. So I had to do it by myself, adding the MBProgressHud to OtherLinkerFlags.

enter image description here


i have the same problem with 7 errors when i add PSTCollectionviewcontroller .The one solution for this problem is check your "xcode --> build phases-->compile sources" here add your all ".m" files ..I hope you this post will help users in future.


In my case it was a bit different

In the Prefix Header there was a define missing

#ifdef DEBUG
#   define TWDLog(fmt, ...) NSLog((@"\n%s\n" fmt), __PRETTY_FUNCTION__, ##__VA_ARGS__)
#else
#   define TWDLog(...)
#endif

So search for PROJECTNAME-Prefix.pch and check if it has something missing in both projects


Yeah this is related to what allen said... look for TargetMembership in Utilities section of the source file. there is a checkbox that associates that file to a project. Checking this solved this issue for me too.


Adding what worked for me in case others have the same issue and end up here. I had an older project that had the CLANG_ENABLE_MODULES setting set to No. After hours of frustration I compared to a working project and found I had Enable Modules Set to no under my LLVM build settings. Setting this to Yes solved my problem and the app builds fine.

Project Settings -> Build Settings -> search for 'Modules' and Update Enable Modules (C and Objective-C) to YES.


When I encountered the same problem, i forgot to add "compiled version of library(with extension .a)". Normally we add the library of the imported project in Target Dependency in Build Phases but we forget to add "compiled library" in Link Binary with Libraries in Build Phases.


I had this issue when I opened the same project twice, only one project was the original and the other was cloned from a git url.

'Product' > 'Clean' solved the problem.


Check the Valid Architectures & Build Active Architecture only properties.

enter image description here


I didnt add the "-all_load -lstdc++" to Other Linker Flags in the build setting and I was able to launch the sim without error but I did not get MonkeyTalk log output when launched and the a previous script that I wrote that used to connect now showed the play button as disabled. The output of the MT IDE showed as "Connection set to iOS Simulator", but not able to select the run/play button.

The original project had "ObjC -all_load" in the Other Linker Flags and when I appended the "-all_load -lstdc++" along with it I got the error message this post is about. When I removed the "ObjC -all_load" and only added the "-all_load -lstdc++" the project built, but still no monkey talk log out put as confirmation in the console


try this one last:

so I tried all the suggestions on this page.. none worked.. The way my problem started was by following the steps in this tutorial that teaches how to link static libraries. With my sample project the instructions worked fine.. but then on my actual project I started getting the error above.

So what I did was go through each step of the said tutorial and built after each step.. the offending line turned out to be this one: adding -all_load to build settings-> other linker flags

it turns out that this flag was recommended once upon a time to link categories to static libraries.. but then it turned out that this flag was no longer necessary Xcode 4.2+.. (same goes for the -force_load flag.. which was also recommended in other posts)..


I discovered this HIGHLY misleading message while trying to upgrade to the new Google Analytics library.

In my case the problem was having TWO CONFLICTING COPIES of the library. They were in different folders but both were listed in my App's Library Build Paths (under Build Settings).

Moving all the deprecated library files out of the folder ended up doing the trick and made the mysterious error messages go away.


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

enter image description here


Is your framework compiled for armv(x)? It looks to me like it's compiled for i386, which code won't run on an iOS device. Or else it's compiled for armv(x) and you're trying to run it on the simulator, which is i386 code. Make sure, using the build settings Akshay displayed above, that your framework is correctly compiled for the chip you're going to run it on.


Change in active architecture worked for me, One of my lib was using i386.

In build settings >> change Build Active Architecture Only to Yes from NO

It worked for me. Hope it helps to others as well.

enter image description here


I got this message when I drag and dropped some source files from another project. When I deleted them and then added them via the "Add Files..." from the File menu, it built without the error.


I got the same issue. And I add 2 framework I need to Build Phases. Hope this help! symbol(s) not found for architecture i386


I had a similar error with NSManagedObject and it was because I was using Core Data but was missing the Core Data framework in Build Phases - Link Binary With Libraries, as some others have answered


Just enable the "Build Active Architecture Only" option

in PROJECT >> Build Settings >> Build Active Architecture Only >> Yes

screenshot of the path to the configuration

remember to check if they are also enabled in each target


Answer is you just drag and drop folder over the project and click copy.


Product => Clean did the trick for me


Try remove the framework, clean project, add it back and compile. Or Remove the class which has been added by xcode in compile source, clean project, add it back then build.


When I encountered the same problem as this:

Undefined symbols for architecture i386:

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

It turned out that I just forgot to add framework. It was QuartzCore.framework to be exact.


On mine, I was using Cocoapods for an Augmented Reality project and what I found out was that when you implement cocoapods and open your project's .workspace, you end up with the Xcode Project target and those Pods target you implemented inside the same file. What was happening was that some of the .m were being used by both. After I removed the duplicated ones for the Xcode target at Build Phases >> Compile Sources, it worked fine.


Remember That you can put some macro in any view controller which is calling the files you've already deleted.

The app will not show any errors until you build your app, it will throw the error in compilation phase in .o files.

Remember to delete any MACRO that's calling to files you've already deleted.

Thanks :)


It's possible you're using a library that is only compiled for REAL hardware. For example, if you're using a Bluetooth library like the Zephyr HxM Smart, it probably won't compile on the simulator, and is only meant to run on real devices.


Also could be that you're missing to link against a Binary Library, check Build Phases in your Targes add required libraries and then Product > Clean Product > Build

That must work too!


I also met this issue and I fixed it by checking if both compile source and link binary with library contained all the file/library/framework I required.

enter image description here


Examples related to ios

Adding a UISegmentedControl to UITableView Crop image to specified size and picture location Undefined Symbols error when integrating Apptentive iOS SDK via Cocoapods Keep placeholder text in UITextField on input in IOS Accessing AppDelegate from framework? Autoresize View When SubViews are Added Warp \ bend effect on a UIView? Speech input for visually impaired users without the need to tap the screen make UITableViewCell selectable only while editing Xcode 12, building for iOS Simulator, but linking in object file built for iOS, for architecture arm64

Examples related to objective-c

Adding a UISegmentedControl to UITableView Keep placeholder text in UITextField on input in IOS Accessing AppDelegate from framework? Warp \ bend effect on a UIView? Use NSInteger as array index Detect if the device is iPhone X Linker Command failed with exit code 1 (use -v to see invocation), Xcode 8, Swift 3 ITSAppUsesNonExemptEncryption export compliance while internal testing? How to enable back/left swipe gesture in UINavigationController after setting leftBarButtonItem? Change status bar text color to light in iOS 9 with Objective-C

Examples related to iphone

Detect if the device is iPhone X Xcode 8 shows error that provisioning profile doesn't include signing certificate Access files in /var/mobile/Containers/Data/Application without jailbreaking iPhone Certificate has either expired or has been revoked Missing Compliance in Status when I add built for internal testing in Test Flight.How to solve? cordova run with ios error .. Error code 65 for command: xcodebuild with args: "Could not find Developer Disk Image" Reason: no suitable image found iPad Multitasking support requires these orientations How to insert new cell into UITableView in Swift

Examples related to compiler-errors

intellij idea - Error: java: invalid source release 1.9 Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug' Deserialize JSON with Jackson into Polymorphic Types - A Complete Example is giving me a compile error Android java.exe finished with non-zero exit value 1 error: expected primary-expression before ')' token (C) What does "collect2: error: ld returned 1 exit status" mean? Python3: ImportError: No module named '_ctypes' when using Value from module multiprocessing Maven error :Perhaps you are running on a JRE rather than a JDK? What does a "Cannot find symbol" or "Cannot resolve symbol" error mean? Operator overloading ==, !=, Equals

Examples related to email-integration

Trying to get Laravel 5 email to work How to configure SMTP settings in web.config Can there be an apostrophe in an email address? Undefined symbols for architecture i386: _OBJC_CLASS_$_SKPSMTPMessage", referenced from: error Sending emails in Node.js? How to send 100,000 emails weekly? Is it possible to add an HTML link in the body of a MAILTO link