iPhone - 如何确定现有项目的部署目标 iOS 版本
我有一个现有的大型 iOS 项目,默认设置为 iOS 5.0 目标。但我很确定它也是 4.??符合。
我如何知道我的应用程序可以定位的最低 iOS 版本,而不必逐字比较整个代码与 iOS 文档来了解每个方法/常量/...它引入的 iOS 版本,以及在最后,知道我可以定位的最低 iOS 版本是多少吗?那需要几周的时间!
(XCode 没有帮助...将 iOS 目标设置为低于 iOS 5 的版本在编译时不会引发任何警告或错误,所以我不知道,例如,当将目标版本设置为 iOS 时,哪些方法仅适用于 iOS 4.2 4.1...)
I have an existing huge iOS project, set for iOS 5.0 target by default. But I'm pretty sure that it is also 4.?.? compliant.
How may I know the minimum iOS version my app can be targeted to, without having to compare the whole code word by word with the iOS documentation to know for each method/constant/... the iOS version it was introduced, and at the end, know what minimum iOS version I can target ? That would take weeks !
(XCode does not help... Setting the iOS target to something lower that iOS 5 never raises any warning nor error when compiling, so I don't know for example, which methods are only available for iOS 4.2 when setting target version to iOS 4.1...)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您使用过任何 iOS 5 API,那么当该代码尝试在 iOS 4.x 上执行时,应用程序将会崩溃,除非您在调用方法之前放入一些代码来检查这些方法是否可用(在文档)。
将部署目标设置为 iOS 4.3。在模拟器中,左上角的下拉列表中应该为您提供 iOS 5 或 4.3 模拟器的选择。选择 4.3,然后彻底测试您的应用程序,如果崩溃,您可以检查控制台日志以查找有问题的 API 调用,然后找出解决办法。
如果您在构建下拉列表中看不到 4.3,那么您一定仍将 5.0 作为部署目标。
我建议不要将部署目标设置为 4.3 之前的版本,除非您有一个运行可以使用的早期操作系统的测试设备。
因此,您的问题的答案是,部署目标应该是您能够在其上测试应用程序的最早版本的 iOS(使用模拟器或实际设备),除非您依赖更高操作系统版本中的 API 并且可以'不要在他们周围工作。
If you've used any iOS 5 APIs then the app will crash when that code tries to execute on iOS 4.x unless you put in some code to check that the methods are available before calling them (look up "respondsToSelector:" in the documentation).
Set your deployment target to iOS 4.3. In the simulator, in the top-left drop down it should offer you a choice of iOS 5 or 4.3 simulators. Select 4.3, then test your app thoroughly, if it crashes you can check the console log to find the offending API call and then work out what to do about it.
If you can't see 4.3 in the build dropdown then you must have still got 5.0 as your deployment target.
I suggest not setting the deployment target any earlier than 4.3 unless you have a test device running an earlier OS that you can use.
So the answer to your question is, the deployment target should be the earliest version of iOS that you are able to test the app on (either with the simulator or an actual device), unless you rely on APIs in later OS versions and can't work around them.
在目标的构建设置中,您可以搜索部署目标。这将为您提供有关开发此应用程序的 iOS 最低版本的信息。
In the build setting of your target , you can search for the deployment target. That will give you the information about the minimum version of iOS for which this app was developed.