如何使用 libSystem.B 在 XCode 4 中构建 iOS 3.1 部署目标? [英] How can I build in XCode 4, for an iOS 3.1 deployment target, using libSystem.B?

查看:27
本文介绍了如何使用 libSystem.B 在 XCode 4 中构建 iOS 3.1 部署目标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近从 XCode 3 升级到了 4,现在我的 iPhone 项目出现了构建问题.我需要支持旧版本的 iOS 回到 3.1.使用 XCode 3.2.5,我使用 SDK 4.2 构建没有问题,使用 iOS 部署目标 3.1.我还包含了一个指向 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 的库collect2: ld 返回 1 个退出状态命令/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2 失败,退出代码为 1

推荐答案

在Other Linker Flags"下的项目构建设置中添加以下内容:

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 在 XCode 4 中构建 iOS 3.1 部署目标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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