Group Group Group Group Group Group Group Group Group

Open Uber app from my app

Hello,
Im having toruble with opening uber app from my app. I try to open app, when score is = 26. It goes directly to itunesUrl link, so it opens appstore with uber app instead of app directly. Maybe you’ll have any ideas how to deal with it. Here is my code:

 func callUrl(){
              if let url = NSURL(string: "Uber://"), UIApplication.shared.canOpenURL(url as URL) {
                  UIApplication.shared.open(url as URL)
              } else if let itunesUrl = NSURL(string: "https://apps.apple.com/us/app/uber/id368677368"), UIApplication.shared.canOpenURL(itunesUrl as URL) {
                  UIApplication.shared.open(itunesUrl as URL)
                }
                }

And in else if statement:

  else if score == 26 {
        promilLabel.text = "Open app"
self.callUrl()

Ok, I got answer:

properly code is:
if let url = URL(string: “uber://”),
UIApplication.shared.canOpenURL(url) {

    UIApplication.shared.open(url)
}
else {
    UIApplication.shared.open(URL(string: "https://apps.apple.com/us/app/uber/id368677368")!)
}

Also it is necessary to add it in your info.plist:

<key>LSApplicationQueriesSchemes</key>
<array>
<string>uber</string>
</array>

Hi @pawelzet,

Good that you got the uber:// url, however it only opens the uber app, what if you want to do more? There is a document that provides more details.

https://developer.uber.com/docs/riders/ride-requests/tutorials/deep-links/introduction

cheers,