2017-10-05 141 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是很容易使用。

相關問題