2017-10-05 142 views
1

我需要打开我的ios应用程序的默认时间表骑车屏幕的超级应用程序。现在我正在使用这段代码。但它只是导航用户超级应用程序。如何使用其他ios应用程序的默认日程安排屏幕打开超级应用程序?

if (UIApplication.shared.canOpenURL(NSURL(string:"uber://")! as URL)) 
    { 
     // if your app is available it open the app 
     Utilities.openScheme(scheme: "uber://?action=setPickup") 
    } 
    else 
    { 
     // it redirect to safari, safari directly open the web page on uber application, it does not redirect to app store 
     //UIApplication.shared.openURL(NSURL(string:"http://m.uber.com/?opneapp")! as URL) 
     Utilities.openScheme(scheme: "https://itunes.apple.com/us/app/uber/id368677368") 
    } 

在这里,我附上了需求的图像。 image

我该如何在iOS Swift 3中做到这一点?

回答

3

要解决此问题,请阅读Uber dev docs

这是一个小提示。

在iOS,Android或Windows Phone应用程序中,优步车手应用程序可以使用uber://模式打开 。您的应用可以使用其他参数在优步应用 中启动特定操作。

例子:

uber://?client_id=<CLIENT_ID>&action=setPickup&pickup[latitude]=37.775818&pickup[longitude]=-122.418028&pickup[nickname]=UberHQ&pickup[formatted_address]=1455%20Market%20St%2C%20San%20Francisco%2C%20CA%2094103&dropoff[latitude]=37.802374&dropoff[longitude]=-122.405818&dropoff[nickname]=Coit%20Tower&dropoff[formatted_address]=1%20Telegraph%20Hill%20Blvd%2C%20San%20Francisco%2C%20CA%2094133&product_id=a1111c8c-c720-46c3-8534-2fcdd730040d&link_text=View%20team%20roster&partner_deeplink=partner%3A%2F%2Fteam%2F9383 

也可以尝试使用尤伯杯SDK是很容易使用。

相关问题