GPUberView 1.1.5

GPUberView 1.1.5

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Dec 2015

Maintained by George Polak.



 
Depends on:
JSONModel~> 1.0
Bolts~> 1.1
PulsingHalo>= 0
Masonry~> 0.6
INTULocationManager~> 4.0
BlocksKit~> 2.2
 

  • By
  • George Polak

Summon Uber from your iOS app with 2 lines of code.

GPUberView

Quick Start

#import <GPUberViewController.h>

// ...

GPUberViewController *uber = [[GPUberViewController alloc] initWithServerToken:@"your_server_token"];

// optional
uber.startLocation = CLLocationCoordinate2DMake(40.7471787,-73.997494);
uber.endLocation = CLLocationCoordinate2DMake(40.712774,-74.006059);

[uber showInViewController:self];

Demo

  1. Go to the GPUberViewDemo directory.
  2. Open the .xcworkspace (not the .xcodeproj) file.
  3. Run the app in the Simulator or on the device.

Note:

If the phone has the Uber app installed, tapping any of the Uber service buttons will bring it up with the appropriate parameters already set. Otherwise the Uber mobile website will be launched.

Adding GPUberView to Your Project

Usage

Register You App With Uber

To use this library you need a valid Server Token from Uber. You can get it here: https://developer.uber.com

Add url schemes

For iOS 9 compatibility, add the following scheme to your application's info.plist:

<key>LSApplicationQueriesSchemes</key>
<array>
    <string>uber</string>
</array>

Import GPUberView

#import <GPUberViewController.h>

Initialize the GPUberViewController

Pass in your Uber server token for authentication.

GPUberViewController *uber = [[GPUberViewController alloc] initWithServerToken:@"your_server_token"];

(Optional) Specify the Pickup and/or Destination

You can pass-in the desired pickup and dropoff coordinates as CLLocationCoordinate2D structs.

// example: from Boston South Station to Fenway Park
uber.startLocation = CLLocationCoordinate2DMake(40.7471787,-73.997494);
uber.endLocation = CLLocationCoordinate2DMake(40.712774,-74.006059);
  • If you omit startLocation, GPUberView will attempt to determine it based on your user's current location. For iOS 8.0 and higher, this requires you to add the NSLocationWhenInUseUsageDescription key into your application's Info.plist file. The value should be a short string explaining the reason why your app needs location (e.g., "Uber needs to determine your pickup location.").

  • If you omit the endLocation, GPUberView will not be able to calculate the price estimate, but still will be able to show the estimated pickup time.

Note: If you supply both the pickup and dropoff locations, make sure the distance between the two isn't exceedingly large. Most Uber products cannot drive you from San Francisco to New York.

You can also pass in user-readable names of the pickup and dropoff points. These labels will be shown to the user as the pickup and dropoff labels in the Uber app once launched. If not supplied, GPUberView (or the Uber app itself) will attempt to determine these automatically.

uber.startName = @"South Station";
uber.endName = @"Fenway Park";

(Optional) Add Your Client Id

Add your Uber client id to receive Uber credits for new user signups. You can get it here: https://developer.uber.com

uber.clientId = @"your_client_id";

Show GPUberView

[uber showInViewController:self];

License

GPUberView is available under the MIT license. See the LICENSE file for more info.