Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Uber iOS App URL Scheme? [closed]

Tags:

ios

url-scheme

I'm writing a small "brochure"-style iOS app and want to allow users to tap a link to open the Uber app with a prefilled discount code. Usually I'd do this through a custom url scheme, but I can't find any documentation that Uber supports one for this workflow.

Poking around I notice that uber:// DOES open the Uber app, but I've been unable to guess how to pass in an offer code in the url.

I'm guessing it's not supported and that's fine, but it'd be a nice-to-have. Anyone know the specifics here?

like image 663
eeeee Avatar asked Aug 04 '14 23:08

eeeee


1 Answers

Noted above, but just to close the question.

From Uber support: "You can use uber:// to call open the Uber app, but unfortunately we don't have one handy or public for plugging right into the promo code field."

What I ended up doing here is putting the code on the pasteboard and opening the app or pushing over to the app store...

[[UIPasteboard generalPasteboard] setString:@"THE_PROMO_CODE"]; //be sure this is clearly labeled in the UI to prevent inadventent data loss

NSURL* uberURL = [NSURL URLWithString:@"uber://"];
NSURL* appStoreURL = [NSURL URLWithString:@"itms-apps://itunes.apple.com/us/app/uber/id368677368?mt=8"];

if ([[UIApplication sharedApplication] canOpenURL:uberURL])
{
    [[UIApplication sharedApplication] openURL:uberURL];
}
else
{
    [[UIApplication sharedApplication] openURL:appStoreURL];
}
like image 196
eeeee Avatar answered Oct 13 '22 11:10

eeeee