0

I am creating an app that displays certain movie content. I have added a button that will allow the user to open that movie in IMDB to access more in depth information. I would like for the app to open the IMDB iPhone app if they have it installed, yet it only opens up the website in Safari. Here's what I have so far

    @IBAction func imdbButtonClick(_ sender: UIButton) {
    guard let url = URL(string: "http://www.imdb.com/title/tt5580390") else {
        return //be safe
    }
    UIApplication.shared.open(url, options: [:], completionHandler: nil)
}

I know that IMDB is an app that supports universal links, but I don't know if that means it's possible to provide it in my own app.

  • I know I should have a check to see if the user isn't running iOS 9. That will be added once I have this working on my test device
Dávid Pásztor
  • 51,403
  • 9
  • 85
  • 116
Dustin Johnson
  • 405
  • 1
  • 4
  • 5
  • 1
    Possible duplicate of [Swift: How to open a new app when uibutton is tapped](https://stackoverflow.com/questions/33932303/swift-how-to-open-a-new-app-when-uibutton-is-tapped) – MwcsMac Jan 24 '18 at 22:02

1 Answers1

0

So after using the app for a few weeks and not able to figure out what was going on, I went and deleted IMDB from my test device and re-downloaded it. My app now opens the IMDB app correctly. I'm not sure what the issue was, but the code itself should be ok.

Dustin Johnson
  • 405
  • 1
  • 4
  • 5