iosnsurllaunching

Open application:url:sourceApplication:annotation: at launch iOS app


I want to launch or open an specific screen of my iOS app when is launching, for example using DeepLink when I click on the link in mail, if the app is running all goes OK and my app go to my desire screen, but when I try to click when app is not running goes to starting screen after launch screen.

I would like to open an specific screen with deep link but when app is not running.

Thanks


Solution

  • To solve this problem is necessary use func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {}

    With launchOptions of this way:

        if let url = launchOptions?[UIApplicationLaunchOptionsURLKey] as? NSURL { }
    

    With it we can extract the URL and make the same as:

        func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool {