Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
789 views
in Technique[技术] by (71.8m points)

iphone - 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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...