如何使用libSystem.B为iOS 3.1部署目标构建XCode 4? [英] How can I build in XCode 4, for an iOS 3.1 deployment target, using libSystem.B?
问题描述
我最近从XCode 3升级到了4,现在我的iPhone项目出现了问题。我需要支持旧版本的iOS回3.1。使用XCode 3.2.5,我使用SDK 4.2构建没有问题,使用3.1的iOS部署目标。我还包含了一个libSystem.B库的弱链接,这是在旧iOS版本上运行应用程序所必需的。现在,当我使用XCode 4构建时,我在下面得到了链接器错误。编译步骤完成,但链接步骤失败。如果我删除了libSystem.B库的弱链接,那么构建完成,但在iOS 3.1上运行时,应用程序在启动时崩溃。
I've recently upgraded from XCode 3 to 4, and now I'm having build problems with my iPhone project. I need to support older versions of iOS back to 3.1. With XCode 3.2.5, I had no problem building with SDK 4.2, using an iOS deployment target of 3.1. I also included a weak link to the libSystem.B library, which is required for running the app on older iOS versions. Now when I build with XCode 4, I get the linker error below. The compilation step completes, but the link step fails. If I remove the weak link to the libSystem.B library, then the build completes, but the app crashes at startup when running on iOS 3.1.
有没有人找到解决方案这个问题?如何使用XCode 4构建,在旧版本的iOS上运行?
Has anyone found a solution to this problem? How do you build with XCode 4, to run on an old version of iOS?
ld:找不到-lSystem.B $ b的库$ b collect2:ld返回1退出状态
命令/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2失败,退出代码为1
推荐答案
在其他链接器标志下的项目构建设置中添加以下内容:
In your project build settings under "Other Linker Flags" add the following:
-weak_library /usr/lib/libSystem.B.dylib
它应该会自动添加到您的Target构建设置中,但如果它不是'你也应该把它添加到那里。
It should automatically be added to your Target build settings but if it isn't you should add it there as well.
这篇关于如何使用libSystem.B为iOS 3.1部署目标构建XCode 4?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!