[英]Issue using MFMessageComposeViewController on iPhone 8 and iPhone 8 plus running iOS11
[英]prompt the user using a UIAlertController if iOS and device lower than iOS11 and iphone 8?
如果用户在低于iPhone 8和低于iOS 11的iOS版本的设备中安装应用程序,则会弹出UI警报“使用该应用程序的最低要求是iOS 11和iPhone 8或更高版本”,并且有一个确定按钮。 我想告诉用户,不支持他们的设备。 这是代码中的内容。
注意:我确实将部署目标设置为iOS11,但是如何为设备iPhone8设置它?
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
let alertController = UIAlertController(title: "Foo", message: "Bar", preferredStyle: .alert)
alertController.addAction(UIAlertAction(title: "OK", style: .cancel, handler: nil))
// check
if #available(iOS 11.0,*)
{
}
else
{
present(alertController, animated: true, completion: nil)
}
}
}
您可以在info.plist
要求设备支持nfc
。
每个Apple: https : //developer.apple.com/library/archive/documentation/DeviceInformation/Reference/iOSDeviceCompatibility/DeviceCompatibilityMatrix/DeviceCompatibilityMatrix.html
如果您确实(确实)确实希望在运行时限制对iPhone 8的应用程序使用,则可以从SO Answer中读取对UIDevice
进行此扩展的设备模型。
注意,Apple可能不会-或很可能不会-让您将应用发布到AppStore。 极力避免通过代码杀死应用!! 仅显示警报,您的应用程序不旨在在iPhone 8以外的任何设备上运行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.