Viral Mithani
Viral Mithani

Reputation: 323

'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 enter image description here.

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

Appreciated your help.

Thanks.

Upvotes: 0

Views: 1759

Answers (1)

Mykod
Mykod

Reputation: 687

You probably have something like this on you're app delegate: App Delegate

And obviously this way you cannot call app delegate

enter image description here

Either change your minimum deployment target or use frameworks that work with every iOS version you're targeting.

Upvotes: 1

Related Questions