GreatCornholio
GreatCornholio

Reputation: 125

openUrl not being called when I launch the app from Scheme Url

This may be a newbie question.

When Application in the background and I click the scheme URL (something like "myApp://blabla") to launch the app, open url methods work fine. No problem.

But when the app doesn't in the background or killed by swiping up, and after that I click the url(myApp://blabla) the app launches but doesn't call the openUrl methods in AppDelegate.

So, I can't navigate the app correctly.

Solved: As @ctietze told, didFinishLaunchingWithOptions wasn't return true, that was the problem.

Upvotes: 4

Views: 5935

Answers (3)

senanindigo
senanindigo

Reputation: 41

One solution is to comment out the SceneDelegate file, delete ApplicationSceneManifest in info.plist, then restart Xcode. Then the function will be called.

Upvotes: 0

Satish Mavani
Satish Mavani

Reputation: 5075

Make sure you have added "myApp" all details under URL types in info.plist file. You need to add two keys in it. Check image below:

enter image description here

Upvotes: 0

Vyacheslav
Vyacheslav

Reputation: 27211

In this case you have to check didFinishLaunchingWithOptions delegate method

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
   if let url = launchOptions?[UIApplication.LaunchOptionsKey.url] as? URL {
      /// some
   }
 return true
}

Upvotes: 1

Related Questions