Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS symbols not found for architecture i386

I have made a static library after going through http://www.icodeblog.com/2011/04/07/creating-static-libraries-for-ios/. To test this library i made a new project and drag the static library on to the project and tried to test its one method. But it is giving me the error " "_OBJC_CLASS_$_MyLib", referenced from:". MyLib is the name of the library i created.

Steps i took in creating static library. 1. Created a new Xcode project. 2. Choose option to create cocoa touch static library. 3. Wrote two functions in MyLib.h and wrote the implementations one for fibonacci series and other for generating factorial of a number. 3. Built the project and write click on the MyLib.a file with the portion to reveal in finder. 4. Drag MyLib.a file and MyLib.h in a new folder called MyLib.

Any help please

like image 746
Ashutosh Bhatt Avatar asked Dec 04 '22 13:12

Ashutosh Bhatt


1 Answers

When building libraries, frameworks or applications for iOS, XCode will only compile object code for the architectures specified in the build settings for the target. XCode will also only link to binaries that have the specified architecture built in.

In XCode if you select your target you can see under the build settings tab, the architecture for your target. It will contain values like arm6, arm7, and i386.

When running code in the iOS simulator you are running your code on your desktop which is the i386 architecture.

When running on the device the binary has "slices" which are built for that architecture. If the correct architecture "slice" is not present in the binary, it will not run.

If you get the missing i386 architecture error running an iOS application in the simluator you need to make sure that your application and all its dependent libraries have been built for i386 architecture.

Also check that "build active architecture only" is set to NO in the build settings for the target.

If you cant rebuild dependent libraries because you dont have the source, you will have to test on a device supporting arm6 or arm7 architecture.

like image 99
deleted_user Avatar answered Dec 20 '22 21:12

deleted_user