iPhone库:文件不是必需的架构 [英] iPhone library: file is not of required architecture

查看:83
本文介绍了iPhone库:文件不是必需的架构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我搜索了几个小时,但我仍然不知道我的配置有什么问题。
我的项目使用自编写的libray(myLib)。这个库被编译为模拟器 ,它在那里工作得很好。

I have searched for hours however I still have no clue what is wrong with my configuration. My project uses a self-written libray (myLib). This library is compiled to work only for simulator and it works perfectly there.

我必须更改哪些内容以便为我的 iPhone设备进行编译?

What do have to change so it compiles for my iPhone Device as well?

这是我当前的警告:

ld: warning: in /.../myLib.a, file is not of required architecture

这是我的配置(myLib.a)

This is my configuration (of myLib.a)

替代文字http://i38.tinypic.com/kb4zdl.jpg

我发现很多文章解释了这个错误的原因但是我找不到解决方案:

I found a lot of articles explaining the reason for this error however I could not find a solution:


模拟器在x86
架构上运行,而设备使用
ARM架构。

The simulator runs on an x86 architecture, while the device uses an ARM architecture.






我需要更改什么才能让我的库在我的iPhone上工作?


What do I have to change to get my library working on my iPhone?

谢谢

编辑:

到目前为止我做了什么:

What I did so far:


  1. 清理两个项目

  2. 设置l ibrary to'Device'(3.1)

  3. 构建库

  4. 将我的库的.a文件拖到我的应用程序中

  1. Cleaned both projects
  2. Set library to 'Device' (3.1)
  3. Built the library
  4. Dragged the .a file of my library into my application

结果:

这适用于模拟器,但将活动sdk设置为设备仍会提高文件不是必需的架构错误。

This works in simulator but setting the active sdk to device still raises a file is not of required architecture error.

我也试过 mahboudz (感谢您的支持)链接
它解释了如何使用shell脚本构建项目。
但是XCode一直在抱怨库文件架构错误,构建失败。

I also tried mahboudz ( thanks for your support) link. It explains howto built the project using a shell script. However XCode keeps complaining that the library file is of the wrong architecture and the build fails.

这一定是一个非常愚蠢的初学者错误。

This has to be a really stupid beginners mistake.

推荐答案

您需要添加.a文件,为设备构建的文件(build / $ config-iphoneos)和为其构建的文件新项目的sim(build / $ config-iphonesimulator)。确保在放入它们之前对它们进行不同的命名。这就是admob和类似产品提供静态库的方式。

You need to add both .a files,the one built for the device (build/$config-iphoneos)and the one built for the sim (build/$config-iphonesimulator) to the new project. Make sure you name them differently before dropping them in. This is how admob and similar offering ship their static libs.

这篇关于iPhone库:文件不是必需的架构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆