如何将带有 iOS 基础 SDK 6.1 的项目部署到带有 iOS 7 的设备
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18894297/
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 to deploy project with iOS base SDK 6.1 to device with iOS 7
提问by Tamás Zahola
I've been wasting my whole day on this issue, and could not find a solution: I've been developing an application with iOS 6.1 SDK, and the whole design relies on the iOS 6.1 UI. Yesterday, I've updated my phone to iOS 7, and after the update finished, the previously deployed app, which came back from the backup looked and worked the same as before (on iOS 6.1); everything was fine. However, I had to update my Xcode to version 5, so I can continue deploying successive debug versions to my iOS 7 device during development. Before updating to Xcode 5, I've backed up the iPhoneOS6.1.sdk package from Xcode's internal folder; then updated to Xcode 5, and then placed the iPhoneOS6.1.sdk package back in its folder, next to the iOS 7 SDK, which came with the Xcode 5 installation. I've switched my project's base SDK to iOS 6.1, which did came up in the base SDK selector list, and made sure in the interface builder that all my storyboards/XIB's are set to build as iOS 6.1.
我一直在这个问题上浪费我一整天的时间,找不到解决方案:我一直在用iOS 6.1 SDK开发一个应用程序,整个设计依赖于iOS 6.1 UI。昨天,我已将手机更新到 iOS 7,更新完成后,从备份中返回的先前部署的应用程序看起来和工作方式与以前相同(在 iOS 6.1 上);一切都很好。但是,我必须将我的 Xcode 更新到版本 5,这样我才能在开发过程中继续将连续的调试版本部署到我的 iOS 7 设备。在更新到 Xcode 5 之前,我已经从 Xcode 的内部文件夹中备份了 iPhoneOS6.1.sdk 包;然后更新到 Xcode 5,然后将 iPhoneOS6.1.sdk 包放回其文件夹中,在 Xcode 5 安装附带的 iOS 7 SDK 旁边。我已将项目的基础 SDK 切换到 iOS 6.1,
However, when I deploy the application to my phone, it looks like crap, as it's shown with iOS 7 UI elements. If I use a device with iOS 6.1 installed, everything looks fine; it looks like XCode doesn't give damn about my choice of base SDK, and links the application against iOS 7, if I choose to debug on an iOS 7 device.
但是,当我将应用程序部署到我的手机时,它看起来像废话,因为它与 iOS 7 UI 元素一起显示。如果我使用安装了 iOS 6.1 的设备,一切看起来都很好;如果我选择在 iOS 7 设备上调试,看起来 XCode 并没有在意我选择的基础 SDK,并将应用程序链接到 iOS 7。
How can I force Xcode, to deploy the same 6.1-linked stuff to all devices, regardless of it's installed iOS version?
如何强制 Xcode 将相同的 6.1-linked 内容部署到所有设备,而不管它是否安装了 iOS 版本?
回答by karim
Find and download old SDK. Older SDKs are found here, https://developer.apple.com/downloads/index.action?name=Xcode
查找并下载旧的 SDK。在这里可以找到较旧的 SDK,https://developer.apple.com/downloads/index.action?name =Xcode
I have copied the xcode.app directory as Xcode_4.6.3.app
.
Now you can test and debug in both xcode versions. You have to run them from the corresponding folders or create shortcuts in your desktop. When I build from command line i give the parameter as iPhoneOS6.1 instead of iPhoneOS7.0
我已将 xcode.app 目录复制为Xcode_4.6.3.app
. 现在您可以在两个 xcode 版本中进行测试和调试。您必须从相应的文件夹中运行它们或在桌面上创建快捷方式。当我从命令行构建时,我将参数指定为 iPhoneOS6.1 而不是 iPhoneOS7.0
This worked great for me in Xcode5 and iOS. Go to into Xcode5's SDK dir. Add a symbolic link to the old SDK like this:
这在 Xcode5 和 iOS 中对我很有用。进入 Xcode5 的 SDK 目录。向旧 SDK 添加符号链接,如下所示:
ln -s /Applications/Xcode_4.6.3.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk iPhoneOS6.1.sdk
回答by rakmoh
In Xcode 5 toolbar, for your target you will see your device listed twice (you also mentioned this in your question ). For some weird reason one is building with iOS 6.x appearance and the other with iOS7 appearance. Trying building/running on one of the device from this list. If you still see the iOS7 appearance, click the stop in the toolbar, select the other device and build again.
在 Xcode 5 工具栏中,对于您的目标,您将看到您的设备列出两次(您在问题中也提到了这一点)。出于某种奇怪的原因,一个使用 iOS 6.x 外观构建,另一个使用 iOS7 外观构建。尝试在此列表中的设备之一上构建/运行。如果你仍然看到iOS7的外观,点击工具栏中的停止,选择其他设备并重新构建。
I am not seeing any crashes in Xcode 5, so you may want to reinstall if it is crashing a lot for you.
我在 Xcode 5 中没有看到任何崩溃,因此如果它对您来说崩溃很多,您可能需要重新安装。
回答by Andrei
Firstly, you will need to copy and paste the iOS 6.1 SDK from a previous version of XCode. I believe other people have given instructions on how to do this.
首先,您需要从先前版本的 XCode 中复制并粘贴 iOS 6.1 SDK。我相信其他人已经给出了如何做到这一点的说明。
Then, assuming you intend to continue development for iOS 6 (for example, without breaking the iOS 6 UI, and you don't intend to use new APIs), do this:
然后,假设您打算继续为 iOS 6 开发(例如,不破坏 iOS 6 UI,并且您不打算使用新的 API),请执行以下操作:
- XCode should recognize 2 devices every time you plug in an iOS 7 device to your computer
- Run the application on both of them (they are the same device actually, but one of them will be running the application iOS 6-style, and the other one will try to update it to iOS 7-style)
- Remember the one running the app iOS 6-style (for me it's the topmost), and do Product > Archive on thatdevice
- 每次将 iOS 7 设备插入计算机时,XCode 都应识别 2 个设备
- 在它们两个上运行应用程序(它们实际上是同一台设备,但其中一个将运行 iOS 6 风格的应用程序,另一个将尝试将其更新为 iOS 7 风格)
- 记住那个运行 iOS 6 风格的应用程序(对我来说它是最上面的),并在该设备上执行 Product > Archive
This should keep on allowing you to build your applications with the iOS 6 style UI, at the same time allowing you to use Xcode 5. I would recommend starting a new development branch exclusively for UI changes to get your app's UI iOS 7 compatible.
这应该会继续允许您使用 iOS 6 风格的 UI 构建应用程序,同时允许您使用 Xcode 5。我建议专门为 UI 更改启动一个新的开发分支,以使您的应用程序的 UI 与 iOS 7 兼容。