Uber iOS App URL Scheme? [closed]

烂漫一生 提交于 2019-12-12 10:45:49

问题


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?


回答1:


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];
}


来源:https://stackoverflow.com/questions/25129220/uber-ios-app-url-scheme

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!