Reputation: 49
I need to open uber app with default schedule a ride screen from my ios app. Right now i am using this code. but its just navigating user to uber app .
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")
}
Here i have attached image of requirement.
How can i do this in iOS swift 3?
Upvotes: 3
Views: 1533
Reputation: 15512
To solve this issue read Uber dev docs .
This is small hint.
On iOS, Android, or Windows Phone app the Uber rider app can be opened using the uber:// schema. Your app can launch specific actions in the Uber app with additional parameters.
Example:
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
Also try to use Uber SDK it is quite easy to use.
Upvotes: 4