简体   繁体   English

如何使用iOS base SDK 6.1将项目部署到iOS 7设备

[英]How to deploy project with iOS base SDK 6.1 to device with iOS 7

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. 我一直在这个问题上浪费了一整天,但找不到解决方案:我一直在使用iOS 6.1 SDK开发应用程序,整个设计依赖于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); 昨天,我已将手机更新到iOS 7,更新完成后,从备份中返回的以前部署的应用程序看起来和以前一样工作(在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. 但是,我不得不将我的Xcode更新到版本5,因此我可以在开发期间继续将连续调试版本部署到我的iOS 7设备。 Before updating to Xcode 5, I've backed up the iPhoneOS6.1.sdk package from Xcode's internal folder; 在更新到Xcode 5之前,我已经从Xcode的内部文件夹备份了iPhoneOS6.1.sdk软件包。 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. 然后更新到Xcode 5,然后将iPhoneOS6.1.sdk软件包放回其iOS 7 SDK旁边的文件夹中,该软件包随Xcode 5安装一起提供。 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. 我已经将我的项目基础SDK切换到iOS 6.1,它确实出现在基础SDK选择器列表中,并确保在界面构建器中我的所有故事板/ XIB都设置为构建为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. 但是,当我将应用程序部署到我的手机时,它看起来像垃圾,因为它显示在iOS 7 UI元素中。 If I use a device with iOS 6.1 installed, everything looks fine; 如果我使用安装了iOS 6.1的设备,一切看起来都很好; 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设备上进行调试,看起来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链接内容部署到所有设备,无论它是否安装了iOS版本?

Find and download old SDK. 查找并下载旧SDK。 Older SDKs are found here, https://developer.apple.com/downloads/index.action?name=Xcode 较旧的SDK可在此处​​找到, https://developer.apple.com/downloads/index.action? name = Xcode

I have copied the xcode.app directory as Xcode_4.6.3.app . 我已将xcode.app目录复制为Xcode_4.6.3.app Now you can test and debug in both xcode versions. 现在,您可以在两个xcode版本中进行测试和调试。 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 当我从命令行构建时,我将参数设置为iPhoneOS6.1而不是iPhoneOS7.0

This worked great for me in Xcode5 and iOS. 这在Xcode5和iOS中对我很有用。 Go to into Xcode5's SDK dir. 转到Xcode5的SDK目录。 Add a symbolic link to the old SDK like this: 像这样添加旧SDK的符号链接:

ln -s /Applications/Xcode_4.6.3.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk iPhoneOS6.1.sdk

In Xcode 5 toolbar, for your target you will see your device listed twice (you also mentioned this in your question ). 在Xcode 5工具栏中,对于您的目标,您将看到您的设备列出两次(您在问题中也提到了这一点)。 For some weird reason one is building with iOS 6.x appearance and the other with iOS7 appearance. 出于一些奇怪的原因,一个是iOS 6.x外观,另一个是iOS7外观。 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. 如果您仍然看到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中看到任何崩溃,所以如果它为你崩溃很多,你可能想要重新安装。

Firstly, you will need to copy and paste the iOS 6.1 SDK from a previous version of XCode. 首先,您需要从以前版本的XCode复制并粘贴iOS 6.1 SDK。 I believe other people have given instructions on how to do this. 我相信其他人已经指示了如何做到这一点。

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 每次将iOS 7设备插入计算机时,XCode都应识别2个设备
  • 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) 在他们两个上运行应用程序(它们实际上是相同的设备,但其中一个将运行iOS 6风格的应用程序,另一个将尝试将其更新为iOS 7风格)
  • Remember the one running the app iOS 6-style (for me it's the topmost), and do Product > Archive on that device 请记住运行iOS 6风格的应用程序(对我而言,它是最顶级的),并在设备上执行产品>存档

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兼容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM