Jhony  Blaze Jhony Blaze - 11 months ago 56
Swift Question

How to open app from email URL in iOS 9?

I've tried something like:

In the AppDelegate:

func application(application: UIApplication, handleOpenURL url: NSURL) -> Bool {
var returnValue = false
let urlString = url.absoluteString
returnValue = true
return returnValue

In the info.plist


But doesn't work. I want the app opens from a link that I send via email, anyone has an idea to make it work?

Answer Source

For future users, as @iSashok mentioned in the comments, the handleOpenURL function is deprecated as of iOS 9.

For newer versions of iOS you need to use the following function (Apple Docs):

optional func application(_ app: UIApplication, 
                 open url: URL, 
              options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool

You'll be able to keep the body of the function the same as before, and now it will work.