简体   繁体   English

“ AppDelegate”仅在iOS 10.0或更高版本上可用

[英]'AppDelegate' is only available on iOS 10.0 or newer

I am declaring AppDelegate instance for calling method reside in AppDelegate but it is giving me error as 'AppDelegate' is only available on iOS 10.0 or newer , but I want to use AppDelegate instance in iOS 9 also. 我声明用于调用方法的AppDelegate实例驻留在AppDelegate中,但由于“ AppDelegate”仅在iOS 10.0或更高版本上可用,因此出现了错误,但我也想在iOS 9中使用AppDelegate实例。 If I will change my deployment target as iOS 10 then the code is working fine for me but I can not able to run project with deployment target 9.0. 如果我将部署目标更改为iOS 10,则代码对我来说很好用,但我无法使用部署目标9.0运行项目。 I am using Xcode 10.1 and Swift 4.2 in my Xcode project. 我在Xcode项目中使用Xcode 10.1和Swift 4.2。

Please check my below code and let me know if I am doing something wrong 请检查下面的代码,如果我做错了事,请通知我 在此处输入图片说明 .

let appDelegate = UIApplication.shared.delegate as! AppDelegate
appDelegate.ShowErrorPopUpWithErrorCode(strError:"This is test error message")

Appreciated your help. 感谢您的帮助。

Thanks. 谢谢。

You probably have something like this on you're app delegate: 在您的应用程序委托人上,您可能会遇到类似这样的情况: 应用程序委托

And obviously this way you cannot call app delegate 显然,这种方式无法调用应用程序委托

在此处输入图片说明

Either change your minimum deployment target or use frameworks that work with every iOS version you're targeting. 更改最低部署目标或使用适用于您要定位的每个iOS版本的框架。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM