经过,我做了一个静态库http://www.icodeblog.com/2011/04/07/creating-static-libraries-for-ios/.为了测试这个库,我创建了一个新项目并将静态库拖到项目中并尝试测试它的一种方法.但它给了我错误_OBJC_CLASS__$_MyLib",引用自:".MyLib 是我创建的库的名称.
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.
我在创建静态库时采取的步骤.1.新建一个Xcode项目.2. 选择创建可可触摸静态库的选项.3. 在 MyLib.h 中编写了两个函数,并编写了一个用于斐波那契数列的实现,另一个用于生成数字的阶乘.3. 构建项目并点击MyLib.a 文件,在finder 中显示部分.4. 将 MyLib.a 文件和 MyLib.h 拖到一个名为 MyLib 的新文件夹中.
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.
请帮忙
在为 iOS 构建库、框架或应用程序时,XCode 只会为目标的构建设置中指定的体系结构编译目标代码.XCode 也将只链接到具有内置指定架构的二进制文件.
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.
在 XCode 中,如果您选择目标,您可以在构建设置选项卡下看到目标的架构.它将包含 arm6、arm7 和 i386 等值.
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.
在 iOS 模拟器中运行代码时,您是在 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.
如果您在模拟器中运行 iOS 应用程序时遇到缺少 i386 架构的错误,您需要确保您的应用程序及其所有依赖库都是针对 i386 架构构建的.
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.
还要检查在目标的构建设置中仅构建活动架构"是否设置为 NO.
Also check that "build active architecture only" is set to NO in the build settings for the target.
如果您因为没有源而无法重建依赖库,则必须在支持 arm6 或 arm7 架构的设备上进行测试.
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.
这篇关于未找到适用于 i386 架构的 iOS 符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!