Build Static Library in Xcode 4.6 for Simulator - ios

How to build a static library for simulator on Xcode 4.6?
I've tried "https://github.com/kstenerud/iOS-Universal-Framework". But got an error while using that framework on demo.
Error is like:
ld: warning: ignoring file /Users/shuvo/test_lib/Demo(V.1)/myProject.lib/libMyProjectLibrary.a, missing required architecture i386 in file /Users/shuvo/test_lib/Demo(V.1)/myProject.lib/libMyProjectLibrary.a (2 slices)
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_showScreen", referenced from:
objc-class-ref in ViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I came across the same problem,and solve it by setting the static lib's run configuration as Release in the scheme editor.
here is the words in the document of iOS-Universal-Framework, section "Building your iOS Framework":
step 2.(optional) Set the "Run" configuration in the scheme editor.
It's set to Debug by default but you'll probably want to change it to
"Release" when you're ready to distribute your framework.
the key is the "Build Active Architecture Only" in Build Settings,
Debug is set to NO by default

Related

Undefined symbols for architecture x86_64 Xcode

I added a SDK manually into my swift project that was wrote in obj-c and I create bridging header for the header file of it.
I can use all functions and classes defined in SDK and Xcode knows them (by changing their color and no errors) but when I run the project there is one error and one warning:
the issue navigator
warning:
ignoring file /Volumes/Macintosh HD/Users/arashetemad/Documents/MPosDocs/IOS/MESDK.framework/MESDK, missing required architecture x86_64 in file /Volumes/Macintosh HD/Users/arashetemad/Documents/MPosDocs/IOS/MESDK.framework/MESDK (3 slices)
error:
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_NLBlueToothV100ConnParams", referenced from:
objc-class-ref in MPos.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
If MESDK is your framework you need to add the missing architecture in the build settings of MESDK project (supported architectures) to support it
If it's not yours, you need to ask from the developer to do it...

iOS Project Build Problems

My project, in iPhone5s simulator running above normal, but iPhone5 compile error, an error message is as follows:
ld: warning: directory not found for option '-L/Users/apple/Desktop/……/UMSocial_Sdk_3.3.7'
ld: warning: ignoring file /Users/apple/Desktop/……_SDK/lib/libP2P_device.a, missing required architecture i386 in file /Users/apple/Desktop/……_SDK/lib/libP2P_device.a (2 slices)
ld: warning: ignoring file /Users/apple/Desktop/……/UMAnalytics_Sdk/libMobClickLibrary_armv6.a, file was built for archive which is not the architecture being linked (i386): /Users/apple/Desktop/……_Sdk/libMobClickLibrary_armv6.a
ld: warning: ignoring file /Users/apple/Desktop/……_iOS_SDK/lib/libP2P.a, file was built for archive which is not the architecture being linked (i386): /Users/apple/Desktop/……2P.a
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_InterfaceJump", referenced from:
objc-class-ref in CommonFunc.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Your project link some file didn't support i386 architecture. Maybe this file ??just support arm architecture.
You should make sure your "Build Settings" -> "Valid Architectures" didn't contain i386. iPhone5's architecture is "armv7", it shouldn't compile for architecture i386.
If your just want to build target phone architecture, you can set "Build Active Architecture Only" to YES.
I sorry, I think your iPhone5 is device, you can try to change "Valid Architecture" to only support 64bit or 32bit arm architecture, and change "Build Active Architecture Only" to have a try.
iPhone5 simulator is build fine, and iPhone5s build failed usually is arm64 problem.

Undefined symbols for architecture x86_64 iOS

I have used cocoapods to install the upnpx library which successfully builds. But as soon as I went to build after using one of the classes In my project I am faced with this error:
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_UPnPManager", referenced from:
objc-class-ref in RendererView.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
SOLVED: For me, setting "Build active architectures only" to YES in build settings of the project target resolves this issue

CocoaPods not linking with the project

I have a project that uses CocoaPods. It was working but something got broken.
It does compile if I target the simulator, but If I target the devise (Build or Archive) it throws a linker error.
ld: warning: ignoring file /Users/myuser/ios/share/share/libPods.a, file was built for archive which is not the architecture being linked (armv7s): /Users/myuser/ios/share/share/libPods.a
Undefined symbols for architecture armv7s:
"_OBJC_CLASS_$_AFHTTPRequestOperationManager", referenced from:
objc-class-ref in BackendProxy.o
ld: symbol(s) not found for architecture armv7s
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I really need some help because I am really stucked.
Thanks!
EDIT: i deleted that libPods.a, that was an old one, and now it's giving me:
ld: library not found for -lPods
But only on Archive or Build for iosDevice, this is still working on the simulator.
Try removing armv7s from valid architectures section.
Build Settings -> Architectures -> Valid Architectures

Architecture issue in iOS

I'm using Reachability on my project to get the type of connection used, but an error has ocurred.
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_Reachability", referenced from:
objc-class-ref in ContributionViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I don't know what to do... my project is for iOS 4.3 and I've never had this kind of problem before.
Thx
Did you include the reachability framework in your projects linked libraries ? You can confirm by clicking on your project file on the file list and checking the build phases tab. It should be listed in the linked library section,

Resources