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

35

245

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.

Kessiah answered 8/8, 2011 at 15:17 Comment(2)
After adding SystemConfiguration.framework from build phases my project compiles wellNyeman
I Solved this issue.I have added the require framework to Link Binary with Libraries.Rowell
E
570

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

Ezaria answered 24/2, 2012 at 22:14 Comment(9)
Sometimes those errors appear because some framework is not linked properly. Just check all frameworks in "Link Binary With Libraries" in project's build-phase tab.Fascinating
This can also happen with .c files, and presumably .mm too.Breakable
Rajneesh, did you fix the issue? If yes, how did you fix it?Ringside
Its worth noting that you can select the .m file and tick the box next to your target in right panel "Target Membership" section. When you add a file to your project, you are asked if you want to "Add to targets:", you may have said no, but you can add it at any time by doing what i said.Crowns
I used to have the same error, the solution for mine is: Build Setting -> Linking -> Other Linker Flags -> Add -lLibraryName_$(PLATFORM_NAME)d for Debug, and add -lLibraryName_$(PLATFORM_NAME) for ReleaseVaca
I had to click "Add Another" then go find it in the file directory. Then add it. Then add it again.Papacy
It happened to me whenI added Google Analytics. I forgot to add the static lib. I added only the .h filesArlina
I had this issue after using cordova cli to remove and add a core plugin which had been updated (Camera). The .m was not in the Compile Sources, so I added it. Then got the architecture warning. The ImageIO.framework was missing, so adding that in the Link Binary With Libraries fixed the errors. Thanks Heitara!Larrup
You can actually see the concrete symbols generated using the nm tool. Terminal to the path of the .o files, and run nm -g on the file that is calling the symbol and the one that should have the symbol, and you should see if they match up or not, which can provide clues for the error. nm -g file.o You can inspect the C++ symbols demangled with this: nm -gC file.oOkajima
B
37

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

Bangweulu answered 20/9, 2012 at 12:44 Comment(3)
This seemed like a long shot as it didn't really match the error messages I was getting but adding the dependent frameworks suggested on the SocketRocket site fixed it for me as well.Jackanapes
Even if you add frameworks through cocoapods this can happen. I had to add it manually as a framework too. Thanks!Sightly
The Framework that I added needed other Frameworks to be added before it would build. If you're adding a Framework, check to make sure you've added any Framework it may needWhatley
V
29

Check the Valid Architectures & Build Active Architecture only properties.

enter image description here

Versicle answered 8/8, 2011 at 15:40 Comment(4)
can you please tell me how to open this option window in Xcode 4.2Inhaul
If this doesn't help, see Allen Pike's answer below.Denier
Both this answer and Allen's one helped me. I really had to check both things: Compile Sources and Build Active Architecture Only. Thanks a lot guys!Shantishantung
@Inhaul They are in Build Settings for the target.Surrounding
N
18

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

enter image description here

Nike answered 19/10, 2015 at 8:57 Comment(0)
J
10

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.

Janey answered 8/8, 2011 at 15:52 Comment(3)
Its sorted. i had to just drag and drop framework forlder into my project forlder in xCode. ThanksKessiah
is it possible to somehow compile a framework to run on both iOS device and simulator simultaneously? or should I always choose only one option?Crowning
Are you talking about opening two windows to the same project, and setting one to run on the simulator and another on the device?Janey
I
7

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.

Incite answered 24/10, 2012 at 3:49 Comment(0)
M
4

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.

Muscadine answered 20/3, 2012 at 20:23 Comment(1)
I modified all of the other settings, but this was the one that finally fixed it for me. Thanks!Salvador
T
4

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!

Traumatism answered 9/11, 2012 at 23:37 Comment(0)
K
4

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.

Kinch answered 3/1, 2013 at 20:19 Comment(0)
A
4

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

Apache answered 7/1, 2013 at 14:10 Comment(0)
Z
4

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.

Zondra answered 16/1, 2013 at 16:30 Comment(1)
@JayprakashDubey Ask Mitch pleaseGreatuncle
G
4

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

Greatnephew answered 8/2, 2013 at 0:3 Comment(0)
I
3

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.

Ise answered 27/3, 2013 at 12:25 Comment(0)
W
3

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.

Whiffet answered 9/9, 2014 at 19:31 Comment(1)
Wonderful fix! This helped me a lot! I had an old pods project and every time I added a new pod this error would happen. Thanks!!!Veridical
P
3

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

Pyrophotometer answered 30/6, 2019 at 14:22 Comment(1)
"from NO to YES" is easier to understand. Whatever, this worked.Harhay
W
2

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

Wildman answered 9/4, 2013 at 18:11 Comment(0)
V
2

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.

Veridical answered 7/10, 2013 at 19:41 Comment(0)
D
2

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.

Dylan answered 3/8, 2014 at 16:11 Comment(0)
L
1

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.

Lancewood answered 7/1, 2013 at 17:23 Comment(0)
D
1

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.

Dudden answered 25/4, 2013 at 8:3 Comment(0)
O
1

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.

Oscillatory answered 3/2, 2014 at 20:19 Comment(0)
M
1

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

Mitchellmitchem answered 16/8, 2014 at 10:22 Comment(0)
B
1

Product => Clean did the trick for me

Brott answered 6/11, 2014 at 10:6 Comment(0)
K
0

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

Kessiah answered 9/8, 2011 at 9:53 Comment(0)
S
0

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.

Switchblade answered 7/7, 2012 at 14:37 Comment(0)
R
0

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

Rules answered 17/7, 2013 at 17:7 Comment(1)
Welcome to SO Sam. When answering a question, try to add new insights, research, or code that doesn't already exist in another answer. If you simply want to share that another answer worked for you, try upvoting or commenting on their answer instead of posting a duplicate answer.Wilton
D
0

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

Decade answered 11/9, 2013 at 14:55 Comment(0)
M
0

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.

Mellissamellitz answered 13/10, 2013 at 8:16 Comment(0)
M
0

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

Mishear answered 21/1, 2014 at 1:49 Comment(0)
I
0

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

Idolah answered 11/3, 2014 at 15:12 Comment(0)
C
0

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

Cassell answered 27/6, 2014 at 6:3 Comment(1)
I know it's late but it could help someoneCassell
P
0

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

Poundal answered 14/11, 2014 at 9:12 Comment(0)
B
0

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

Bascio answered 28/12, 2014 at 11:49 Comment(0)
D
0

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

Despotism answered 9/3, 2017 at 15:18 Comment(0)
L
0

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

Lw answered 30/4, 2020 at 3:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.