相关疑难解决方法(0)

如何查看iOS版本?

我想检查iOS设备的版本是否大于3.1.3 我尝试过的东西:

[[UIDevice currentDevice].systemVersion floatValue]
Run Code Online (Sandbox Code Playgroud)

但它不起作用,我只想要一个:

if (version > 3.1.3) { }
Run Code Online (Sandbox Code Playgroud)

我怎样才能做到这一点?

objective-c ios

837
推荐指数
13
解决办法
44万
查看次数

UIAlertView/UIAlertController兼容iOS 7和iOS 8

我正在使用Swift编写应用程序,我需要显示警报.该应用必须兼容iOS 7和iOS 8.由于UIAlertView已被替换UIAlertController,如何在UIAlertController不检查系统版本的情况下检查是否可用?我听说Apple建议我们不要检查设备的系统版本,以确定API的可用性.

这就是我在iOS 8中使用的,但是在iOS 7上用" dyld: Symbol not found: _OBJC_CLASS_$_UIAlertAction" 崩溃了:

let alert = UIAlertController(title: "Error", message: message, preferredStyle: .Alert)
let cancelAction = UIAlertAction(title: "OK", style: .Cancel, handler: nil)
alert.addAction(cancelAction)
presentViewController(alert, animated: true, completion: nil)
Run Code Online (Sandbox Code Playgroud)

如果我使用UIAlertView for iOS 8,我收到此警告: Warning: Attempt to dismiss from view controller <_UIAlertShimPresentingViewController: 0x7bf72d60> while a presentation or dismiss is in progress!

uialertview ios swift uialertcontroller

57
推荐指数
5
解决办法
5万
查看次数

当我支持较低的iOS版本时,我是否必须处理弃用?

例如,假设我的iOS应用程序支持iOS 7.0,我想发出提醒.在iOS 7中,我会使用UIAlertView.在iOS 8/9中,已被弃用UIAlertController.我是否必须检查if currentVersion > iOS7,然后alertView为iOS7和alertControlleriOS8 + 创建两个警报?或者可以UIAlertView在iOS7应用程序中使用,即使它最终将在iOS9 +设备上运行?

我是否需要检查当前的iOS版本,并实现多个对象(每个版本一个),这样的简单事项

ios

5
推荐指数
1
解决办法
64
查看次数

标签 统计

ios ×3

objective-c ×1

swift ×1

uialertcontroller ×1

uialertview ×1