symbol not found for architecture i386 - objective-c

I am facing the problem when integrate one project in another project in xCode for iPad. and throws the error like "symbol not found for architecture i386".

The problem is most likely that the project is not including one of the frameworks. Go to your Target -> Build Phases -> Link and verify that in fact you have all needed frameworks there.

Related

Compile framework with Xcode 9

When I compile framework with Xcode 8 and after that import in new project it successfully build and I am able to test it. But when I compile framework with Xcode 9 and after that add builded framework in new project I got:
Undefined symbols for architecture arm64:
"___llvm_profile_runtime", referenced from:
___llvm_profile_runtime_user in xxxxxxxxx(DMCService.o)
___llvm_profile_runtime_user in xxxxxxxx(APXUserInterfacePresentor.o)
___llvm_profile_runtime_user in xxxxxxxxx(APXDevice.o)
___llvm_profile_runtime_user in xxxxxxxxx(APXInboxService.o)
___llvm_profile_runtime_user in xxxxxxxxx(AppoxeeManager.o)
___llvm_profile_runtime_user in xxxxxxxxx(APXApplicationSession.o)
___llvm_profile_runtime_user in xxxxxxxxx(APXInbox.o)
...
(maybe you meant: ___llvm_profile_runtime_user)
ld: symbol(s) not found for architecture arm64
I check builded framework with -lipo -info architecture and it has arm64.
This is happening only if I build framework for real device, if I build it for simulator it works fine. So I can not figure out why it is not working?
Thanks in advance for help.
Likely your framework build configuration has the setting "Enable Code Coverage Support" (the underlying setting name is CLANG_ENABLE_CODE_COVERAGE) set to YES, while in the application you include the framework, the same setting is set to NO.
For why this causes the Undefined symbols error: enabling the setting causes calls to instrumentation functions to be injected into in the framework code. But when building the app, the library where these functions are defined is not linked. So the linker (ld) fails.
Try again, building the framework with Enable Code Coverage Support set to NO.
Also, to avoid these kind of configuration mis-match errors, you might want to build the app and framework at the same time instead of pre-building the framework separately. You can do this by including the framework project as a subproject of the app project, or creating a Xcode workspace that includes both the app project and the framework project.

Xcode5 compiling 64-bit app error

I had an app works fine on Xcode5.0.2 with architecture armv7 & armv7s.But when I switch to "standard architecture" which plus arm64,it turns out all the third-party library managed by cocoapods went wrong,as shown below:
I'm wondering if anyone has encountered this kind of issue already,what is the solution to this,hopefully you could give me some instructions,thanks in advance.
The underlying issue here is that the CocoaPods you use have not been modified yet to support the ARM64 architecture thus they cannot be linked when you build them. Likely you cannot use those pods until they are updated to support ARM.
You can fix the linker error by going to project -> target of your project -> build settings and change architectures to default architectures (e.g. ARMv7, ARM7s), and valid architectures to ARMv7, ARMv7s.
Also try setting 'build active architectures only' to YES in release and then execute pod install again.

XCode won't compile due to armv7s slice error [duplicate]

I upgraded Xcode version and when using external static libraries, I get this message:
ld: file is universal (3 slices) but does not contain a(n) armv7s slice: /file/location for architecture armv7s
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Is there any way to bypass this and add support to the library if the developer of the library hasn't updated their library yet?
If you want to remove the support for any architecture, for example, ARMv7-s in your case, use menu Project -> Build Settings -> remove the architecture from "valid architectures".
You can use this as a temporary solution until the library has been updated. You have to remove the architecture from your main project, not from the library.
Alternatively, you can set the flag for your debug configuration's "Build Active Architecture Only" to Yes. Leave the release configuration's "Build Active Architecture Only" to No, just so you'll get a reminder before releasing that you ought to upgrade any third-party libraries you're using.
I've simply toggled "Build Active Architecture Only" to "Yes" in the target's build settings, and it's OK now!
Try to remove armv7s from project's "Valid architecture" to release from this issue for iOS 5.1 phone
I just posted a fix here that would also apply in this case - basically, you do a hex find-and-replace in your external library to make it think that it's ARMv7s code. You should be able to use lipo to break it into 3 static libraries, duplicate / modify the ARMv7 one, then use lipo again to assemble a new library for all 4 architectures.
Flurry Support for iPhone 5 (ARMv7s)
As I mentioned in yesterday’s post, Flurry started working on a version of the iOS SDK to support the ARMv7s processor in the new iPhone 5 immediately after the announcement on Wednesday.
I am happy to tell you that the work is done and the SDK is now available on the site.
use menu Project -> Build Settings ->
then remove armv7s from the"valid architectures".
If standard has been chosen then delete that and then add armv7.
In case this happens to someone. I built my own library to use with a third party code. While I was building it to deliver, I accidentally left my iPhone 4S plugged in, and so Xcode built my library only for the plugged architecture instead of following the project settings. Remove any plugged in devices and rebuilt the library, link it, and you should be all right.
Hope it helps.
In my case, I was linking to a third-party library that was a bit old (developed for iOS 6, on XCode 5 / iOS 7). Therefore, I had to update the third-party library, do a Clean and Build, and it now builds successfully.

Linker error for imported header file Xcode 4.5

I have downloaded a header file and static library file (.a file) from the internet. They are provided by the wireless printer which i bought for my iphone and trying to make print functionality working in my app. The problem is when I run the sample app provided by them to test printer, I get the following linker error...Obviously the app was designed in the previous versions of Xcode and Im using Xcode 4.5. Much appreciated if someone could Guide me..
If you are building an iOS project and it's using the i386 architecture, then you must be building for the simulator. What happens when you build for an actual iOS device?
It's possible that the library was compiled only for the processor architectures for real iOS devices, typically armv6, armv7, or armv7s. You can use the file command in Terminal to see what architectures are in the .a library file.
Check these answers Symbols not found for architecture i386? and symbols not found.
Check your project-> build phases -> Link Binary With Libraries whether there is libwspr240.a file is there or not.
Remove libwspr240.a file and then readd it using
Project --> Build Phases --> Link Binary with Libraries click '+' button to add.
Then Clean and Build the project

Conditionally link i386 or armv7 depending on need

I have an Xcode project that is currently using Apache Cordova's static library. I'd like to be able to run this on the simulator as well as on iOS devices. I've currently added the two different libraries to the Xcode project (one that supports i386 and one that supports armv7), but I can't seem to figure out how I would tell the linker which one to link. Up until now I've been using "Other Linker Flags" to tell it the path to the Cordova library.
How would I tell the linker the version of the library it should be using?
I've figured this out
What you have to do is add the two different static libraries to the project. Then remove them from the normal build phases and possibly your source file search locations underneath build settings. Then you have to go to other linker flags, click on debug or release and click on "Add Build Setting" -> "Conditional Build Setting" in the bottom right. It will pop up an new build setting for which you can specify the platform underneath which it should be linked in. You have to add the two architectures for both debug and release if you want it to work.
Check out Apple's tutorial.