0

I am using URL Scheme in my application and for this i am using:

func application(application: UIApplication, openURL url: NSURL,  sourceApplication: String?, annotation: AnyObject) -> Bool {
    print("function called")
    return true
}

it working fine when application is in Background But when i hit a URL and application is Inactive state or application is not running thn this function is not called

Need help to hit this function when application is Terminated. If Can't Then can we have any alternative ?

Muneeb Ali
  • 472
  • 6
  • 14

1 Answers1

0

Of cause you can....

Get URL from "launchOptions" in didFinishLaunchingWithOptions with key "UIApplicationLaunchOptionsKey"

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
if let url = launchOptions?[UIApplicationLaunchOptionsKey.url] as? URL {
    // do your thing...
}
thomas gotzsche
  • 367
  • 2
  • 7