Я использую 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)
Если я использую UIAlertView для iOS 8, я получаю это предупреждение: Warning: Attempt to dismiss from view controller <_UIAlertShimPresentingViewController: 0x7bf72d60> while a presentation or dismiss is in progress!