Get parameter from URL Scheme - Swift Xcode

Viewed 12965

I've made a URL scheme in the Info.plist to call my app, but the URL also parses a string of data which I need to read.

After looking around for a little while I've found - http://www.informit.com/articles/article.aspx?p=2301787&seqNum=2

with the following code

var scheme: String!
var path: String!

var query: String!

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

  scheme = url.scheme
  path = url.path
  query = url.query

  return true
}

supposedly the function is called whenever I call the app through a URL, the function however is never called, and I can't imagine that I would have to put the function in the viewDidLoad, if I did put it in the viewDidLoad it would be called everytime the app started.

Am I wrong im presuming that - the function doesn't need to be called in the viewDidLoad or is there a better way to get data from a URL scheme using the Info.plist to create the scheme

1 Answers
Related