在 Lion 中将较旧的 iOS SDK 添加到 Xcode 4.1 [英] Adding Older iOS SDKs to Xcode 4.1 in Lion

查看:23
本文介绍了在 Lion 中将较旧的 iOS SDK 添加到 Xcode 4.1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚安装了 Lion 和 Xcode 4.1.如何添加较旧的 SDK,以便在 iPhone/iPad 模拟器中构建和运行 4.1 或 4.2?Xcode 4.1 仅附带 iOS 4.3 SDK.

I just installed Lion and Xcode 4.1. How do I add older SDKs so I can build and run in 4.1 or 4.2 in iPhone/iPad Simulator? Xcode 4.1 only comes with the iOS 4.3 SDK.

Lion 是否有某种用于构建的最低 SDK?

Does Lion have some sort of minimum SDK for builds?

谢谢,

推荐答案

其实可以添加旧的 SDK,只要你仍然可以使用旧版本的 Xcode开发工具包.有时它也很有用:当你这样做时,你会发现你可能在编译期间而不是在运行时使用的不受支持的常量和方法.以下是操作方法.

Actually it is possible to add older SDKs as long as you can still get your hands on an older version of Xcode with the older SDK. It's useful too sometimes: when you do this you get to find out about unsupported constants and methods you may be using during compile rather than at runtime. Here's how to do it.

  1. 使用旧版 SDK 获取旧版 Xcode.Apple iOS 开发中心目前列出了 4.3 SDK 和 Xcode 3.2.6 下载.

  1. Get hold of an older version of Xcode with the older SDK. The Apple iOS Dev Center currently lists the 4.3 SDK with the Xcode 3.2.6 download.

安装 dmg 并通过终端打开隐藏在 dmg 中的 Packages 文件夹:

Mount the dmg and open up the Packages folder hidden within the dmg via Terminal:

打开/Volumes/Xcode 和 iOS SDK/Packages/

open /Volumes/Xcode and iOS SDK/Packages/

双击所需 SDK 版本的 pkg 文件.我一直在寻找 iPhoneSDK4_3.pkg,但除了 4.3 之外,还发现了与 iPhoneSDK3_0.pkg 一样古老的软件包.因此,如果您知道在哪里可以找到旧的 SDK(我不知道),那么可能仍会在 App Store 下载中打包较旧的 SDK.

Double click the pkg file for the SDK version you want. I was looking for iPhoneSDK4_3.pkg but, in addition to 4.3, found packages as old as iPhoneSDK3_0.pkg. So perhaps older SDKs may still be packaged with the App Store download if you know where to find it (I didn't).

让它安装在它自己选择的文件夹中,因为您将无法强制它安装在 Applications/Xcode.app/Contents/Developer(现在是 Developer 文件夹所在的位置)中

Let it install in it's own folder of choice since you won't be able to force it to install in Applications/Xcode.app/Contents/Developer (which is where the Developer folder is now)

您会在所选卷的 Platforms 文件夹中找到安装的软件包.将相关的 SDK 移至 Xcode.app 中的 Developer 文件夹.您可能必须使用 sudo:

You'll find the package installed in the Platforms folder in the volume you chose. Move the relevant SDK over to the Developer folder within Xcode.app. You'll likely have to use sudo:

sudo mv/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/

sudo mv /Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/

重新启动 Xcode,您应该会在 Base SDK 选项中看到新(旧)SDK.耶!

Restart Xcode and you should see the new (old) SDK listed in your options for Base SDK. Yay!

2013 年 9 月 12 日更新

如果您尝试添加的旧版 SDK"捆绑在 Xcode 4.3 或更高版本中,添加 SDK 就像从开发中心链接下载 Xcode 一样简单,该链接显示正在寻找旧版 Xcode?"(目前点这里),挂载dmg,然后复制相关文件结束了.

If the "older SDK" you're trying to add comes bundled in Xcode 4.3 or later, adding the SDK is as simple as downloading Xcode from dev center link that says "Looking for an older version of Xcode?" (currently points here), mounting the dmg, then copying the relevant files over.

在终端中,你会做这样的事情(编辑适当的 SDK 版本号):

In terminal, you'd do something like this (edit for the appropriate SDK version number):

cp -R /Volumes/Xcode/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/

对于 4.3 之前的 Xcode 版本的 SDK,旧步骤仍然适用.

For SDKs from versions of Xcode prior to 4.3, the older steps are still relevant.

我发现这恰好适用于让 Xcode 5 GM 编译带有旧 iOS 6 UI 的构建,即使部署在 iOS 7 设备上也是如此.用于修复等待 UI 重新设计的错误.也就是说,必须有一种更简单的方法在 iOS 7 设备上获取 iOS 6 UI.

I found this happens to work for getting the Xcode 5 GM to compile builds that carry the old iOS 6 UI even when deployed on iOS 7 devices. Useful for fixing bugs pending a UI redesign. That said, there's got to be an easier way to get the iOS 6 UI on an iOS 7 device.

这篇关于在 Lion 中将较旧的 iOS SDK 添加到 Xcode 4.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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