简体   繁体   English

安装新的Xcode版本后,较旧的SDK消失了

[英]Older SDK disappeared after installing new Xcode version

Why are old SDKs beeing removed when installing a new version of xcode with new Iphone SDK ? 为什么在使用新的Iphone SDK安装新版本的xcode时会删除旧的SDK? Now we have v4, what settings do I have to make in order that the apps still work with 3.x ? 现在我们有v4,为了使应用程序仍然可以与3.x一起使用,我必须进行哪些设置?

Thanks 谢谢

Set the Base SDK to 4.0 and Deployment Target to 3.x. 将Base SDK设置为4.0,将Deployment Target设置为3.x. Or, in modern conditions, the Base SDK to Latest and Deployment Target to whatever you need. 或者,在现代条件下,Base SDK to Latest和Deployment Target可满足您的需求。

Although 'Zoul' has most succinctly answered the question, I shall make an attempt to elaborate on the 2 settings and point to some useful documents which will help others who are new to the situation. 尽管'Zoul'最简洁地回答了这个问题,但我将尝试详细说明这两个设置,并指出一些有用的文档,这些文档将帮助其他不熟悉情况的人。

  1. Base SDK Version: This indicates the version of the SDK based on which the program has been compiled. 基本SDK版本:这表示基于编译程序的SDK版本。 This can be set from the "Build Settings" for the project or target. 这可以通过项目或目标的“构建设置”进行设置。 You can use API code from Apple in your code introduced up-to that version and compiler will know all the symbols and compile without any issues. 你可以在你的代码中使用来自Apple的API代码 - 该版本和编译器将知道所有符号并编译而没有任何问题。

  2. Deployment target: This is a declaration from your side about the minimum iOS version which should be installed on the user's device to run your code. 部署目标:这是您方面的声明,关于应该在用户设备上安装以运行代码的最低iOS版本。 This setting can be found under "Info" section for Project and "Summary" section for a particular target. 此设置可在项目的“信息”部分和特定目标的“摘要”部分中找到。 Now, important thing to understand is that your code will not automatically run smoothly on devices with older versions of the iOS if you are using API code introduced in later version by Apple. 现在,重要的是要理解的是,如果您使用的是Apple的更高版本中引入的API代码,那么在具有旧版iOS的设备上,您的代码将无法自动运行。 These can be new classes/methods/frameworks introduced by Apple in later version. 这些可以是Apple在更高版本中引入的新类/方法/框架。 You have to ensure by writing necessary conditional code and provide alternate code path to gracefully degrade for older iOS version which does not have the newer API. 您必须通过编写必要的条件代码来确保并提供备用代码路径,以便为没有较新API的旧iOS版本优雅地降级。 It is up-to you to handle version incompatibilities. 您可以自行处理版本不兼容问题。

Apple documentation on the subject can be found in " SDK Compatibility Guide ". 有关此主题的Apple文档可在“ SDK兼容性指南 ”中找到。

To know about the changes with different versions of iOS refer " What's new in iOS ". 要了解不同iOS版本的更改,请参阅“iOS中的新功能 ”。

This topic is also discussed in " iOS Development Guide " under section "Building and Running Application". iOS开发指南 ”的“构建和运行应用程序”一节中也讨论了该主题。 Refer sub-section "Specifying the Runtime Environment". 请参阅“指定运行时环境”小节。

如果您从Time Machine(以及更好!)等系统备份系统,则可以从位于/Developer/Platforms/iPhoneOS.platform/Developer/SDKs和/Developer/Platforms/iPhoneSimulator.platform的备份中复制旧版SDK。 / Developer / SDKs - 然后只需重新启动XCode就可以了。

If you still have the problem after you set Deployment target at least as low as your desired SDK, then you need to download that SDK. 如果在将部署目标设置为至少与所需SDK一样低之后仍然存在问题,则需要下载该SDK。 Luckily, Xcode helps us here also: 幸运的是,Xcode还帮助我们:

  • look after Simulator selector in top left of your Xcode and select More Simulators. 在Xcode的左上角看模拟器选择器,然后选择更多模拟器。 It will open a page like the one below: 它将打开如下所示的页面:

下载SDK视图

  • just select the SDK you need to test your app against. 只需选择测试应用所需的SDK即可。

3.2.3 last beta did remove all other SDK's cause to many people tried publish Apps developed with the beta SDK, which will not be accepted. 3.2.3上一个测试版确实删除了所有其他SDK的原因,许多人尝试使用beta SDK开发的发布应用程序,这将不被接受。 I guess GM is doing still the same 我猜通用汽车仍在做同样的事情

If you want to develop for 4.0,3.2 and 3.0 (plus 3.0,3.1,3.1.2,3.1.3) do the following 如果要开发4.0,3.2和3.0(加上3.0,3.1,3.1.2,3.1.3),请执行以下操作

  • sudo /Developer/Library/uninstall-devtools –mode=all (This will uninstall the current XCode installation) sudo / Developer / Library / uninstall-devtools -mode = all(这将卸载当前的XCode安装)
  • Then install first old XCode (3.2 final) in default folder (/Developer) 然后在默认文件夹(/ Developer)中安装第一个旧的XCode(3.2 final)
  • Then install the new XCode (3.2.3 GM) in other folder (/DeveloperBeta) 然后在其他文件夹(/ DeveloperBeta)中安装新的XCode(3.2.3 GM)
  • This way you will have both. 这样你将拥有两者。 And can launch xcode from either /Developer/Applications/Xcode.app or /DeveloperBeta/Applications/Xcode.app 并且可以从/Developer/Applications/Xcode.app或/DeveloperBeta/Applications/Xcode.app启动xcode

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

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