如何在 Xcode 4.5 中添加旧版本的 iOS SDK
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12523888/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can I add older version of iOS SDK in Xcode 4.5
提问by sinopec
I copied the iOS 5.1 SDK here:
我在这里复制了 iOS 5.1 SDK:
Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs
应用程序/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs
But, I still can't choose the base SDK in Xcode. Can anybody help?
但是,我仍然无法在 Xcode 中选择基础 SDK。有人可以帮忙吗?
回答by Guru
You need to copy the iPhoneOS5.1.sdk to the directory
需要将iPhoneOS5.1.sdk复制到目录下
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk
and iPhoneSimulator5.1.sdk to
和 iPhoneSimulator5.1.sdk 到
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk
(You'll need to restart Xcode to be able to select the SDKs in the Base SDK build option.)
(您需要重新启动 Xcode 才能在 Base SDK 构建选项中选择 SDK。)
回答by Marku
None of the above worked on my 10.8 xcode 4.5.1. Most of the paths given above are not found.
以上都不适用于我的 10.8 xcode 4.5.1。上面给出的大部分路径都没有找到。
Here is my solution note.
这是我的解决方案说明。
- Download xcode_4.4.1_6938145.dmg in https://developer.apple.com/downloads/
- Load up the dmg file then go to Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/ you will find iPhoneOS5.1.sdk (this is what i want in this case).
- Copy iPhoneOS5.1.sdk folder into your Xcode folder /Applications/Xcode/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs
- Restart Xcode
- Open Xcode project setting->build settings->base SDK, then you will see iOS 5.1 option.
- 在https://developer.apple.com/downloads/下载 xcode_4.4.1_6938145.dmg
- 加载 dmg 文件,然后转到 Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/ 你会找到 iPhoneOS5.1.sdk(在这种情况下这是我想要的)。
- 将 iPhoneOS5.1.sdk 文件夹复制到您的 Xcode 文件夹 /Applications/Xcode/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs
- 重启Xcode
- 打开Xcode project setting->build settings->base SDK,你会看到iOS 5.1选项。
回答by benvolioT
From the terminal, run this command, then restart XCode:
从终端运行此命令,然后重新启动 XCode:
cp -r /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/
Note, substitute 'iPhoneOS5.0.sdk' with the name of whatever SDK you're interested in copying.
请注意,将“iPhoneOS5.0.sdk”替换为您有兴趣复制的任何 SDK 的名称。
回答by user1375355
@benvolioT answer is correct, but you need permission:
@benvolioT 答案是正确的,但您需要获得许可:
sudo cp -r /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/
Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/
回答by Dave
Akhildas' solution worked for me. I was able to build against the 5.1 SDK with XCode 4.5.1. One caveat:
阿希尔达斯的解决方案对我有用。我能够使用 XCode 4.5.1 针对 5.1 SDK 进行构建。一个警告:
If you drop an SDK from a version of XCode downloaded by a different Apple ID, the App Store will show that you have an update to 4.5.1 (even though you already have it). When you press the update button, it tells you to log in with the other Apple ID.
如果您从不同 Apple ID 下载的 XCode 版本中删除 SDK,App Store 将显示您已更新至 4.5.1(即使您已经拥有它)。当您按下更新按钮时,它会告诉您使用另一个 Apple ID 登录。
Strange, I wonder where the account information is buried in the 5.1 SDK?
奇怪了,我想知道5.1 SDK里面的账号信息埋在哪里?
Also, when I set a base SDK back to iOS 6, it appears you have to restart XCode to recognize that framework.
此外,当我将基本 SDK 设置回 iOS 6 时,您似乎必须重新启动 XCode 才能识别该框架。
回答by Devaski
Old SDK's for the OS and Simulator might be available from these locations using finder.
可以使用 finder 从这些位置获得用于操作系统和模拟器的旧 SDK。
For OS
操作系统
/Developer-old/Platforms/iPhoneOS.platform/Developer/SDKs
/Developer-old/Platforms/iPhoneOS.platform/Developer/SDKs
For Simulator
模拟器用
/Developer-old/Platforms/iPhoneSimulator.platform/Developer/SDKs
/Developer-old/Platforms/iPhoneSimulator.platform/Developer/SDKs
Developer-old, you would find it in device volume path.
老开发人员,您会在设备卷路径中找到它。
回答by Deep
xcode.app> Right Click > Show Package Contents
xcode.app> 右键单击 > 显示包内容
It will open xcode package contents.
它将打开 xcode 包内容。
Go to the directory path -
转到目录路径 -
Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs
目录/Developer/Platforms/iPhoneOS.platform/Developer/SDKs
Now you can see the folder name with ios sdk version. For example : iPhoneOS(sdk-version).sdk
现在您可以使用ios sdk version看到文件夹名称。例如:iPhoneOS( sdk-version).sdk
回答by Regis_AG
The BEST SOLUTION is to go to the XCode Preferences and to install older versions of iOS simulator / SDK from there, as explained here : https://apple.stackexchange.com/questions/47323/installing-xcode-with-ios-4-3-device-simulator
最佳解决方案是转到 XCode 首选项并从那里安装旧版本的 iOS 模拟器/SDK,如下所述:https: //apple.stackexchange.com/questions/47323/installing-xcode-with-ios-4 -3-设备模拟器
Hope this helps :)
希望这可以帮助 :)