简体   繁体   中英

'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. 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. I am using Xcode 10.1 and Swift 4.2 in my Xcode project.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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