Search code examples
iosswiftsmartbanner

Implement smart banner in iOS9


I have been searching for a way to implement promotional smart banners that take a user to my usual main launch activity from my website, the web code is easy, I just don't know how to do that on the application side.

So I researched that the method I need to implement in the app delegate is:

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

But that function is deprecated in iOS9. The new one is:

func application(app: UIApplication, openURL url: NSURL, options: [String : AnyObject]) -> Bool {
    // code here
}

I want to send the user to the main launcher view controller, and I want to support iOS7 and up. Which func do I implement? Will implementing both call the code twice? What code do I use to just send the user to the main view?


Solution

  • You need to create deep links for your app. A good link that explains how.