比如我以前在 iOS7 版本下开发了一个 APP,一切正常。
后来苹果发布了 iOS8,由于 iOS8 UIAlertController 替代了 UIActionSheet 和 UIAlertView,造成程序在 iOS8 的设备中,UIActionSheet 无法正常使用。
那么问题有四个:
1、我该如何强制 APP 在真机上,以 iOS7 模式运行这个程序?理论上应该可以吧,我记得以前有些程序虽然我用的 iOS7 设备,但是 APP 界面还是 iOS6 的风格,绝对的老程序。
2、如果我更新了代码,用 UIAlertController 修复了问题,那么如果真机是 iOS7 设备,会不会有新的问题出现?比如 iOS7 根本不知道 UIAlertController 是啥导致崩溃?
3、对于一个老程序来说,并没有过多考虑屏幕尺寸的问题, iPhone4、4S、5、5S 都一样处理的,如果这个程序不做修改直接放到 iPhone6 & iPhone6 Plus 上运行,会发生什么情况?可以完美适配么?
4、假如,即使真机是 iOS8 也可以完美运行 iOS7 SDK 写的程序(问题1上说的约束SDK、运行环境?),并且假如我按照 iPhone5S 的尺寸,在 iPhone6 Plus 上也能完美运行。我是不是以后都可以只写 iOS7 SDK + iPhone5S 的代码,然后指望 iPhone6 Plus 自动适配屏幕,然后以后出 iOS9、iOS10 都不会出 BUG ?
iOS 开发新手,跪求大神作答。谢谢。
Cannot "force users". Even if you can, don't do it. Apple strongly encourages developers to adapt to the new system as soon as possible and abandon the old system. However, you can use an older version of the SDK to compile and package, if you never upgrade Xcode.
There may be problems depending on the API and classes you use. If the API or class you use is marked with
NS_ENUM_AVAILABLE_IOS(8_0)
, it will crash on 7.0 and 7.1 systems. In order to adapt to both systems at the same time, you can determine the system version, or userespondsToSelector:@selector(……)
to determine whether the new or old API should be used.If you do not add LaunchScreen, it will enter compatibility mode and stretch directly. The effect is certainly not perfect, even though the font size and pictures are all enlarged, it is still manageable. It’s best to do the adaptation specifically. If LaunchScreen is added, whether it can be adapted depends on your implementation.
Don’t think about it. Mainly based on the new system, supplemented by compatibility with the old system.