测试已测试 | ✗ |
语言语言 | Obj-CObjective C |
许可证 | MIT |
发布最后发布 | 2015年12月 |
由George Polak维护。
依赖 | |
JSONModel | ~> 1.0 |
Bolts | ~> 1.1 |
PulsingHalo | >= 0 |
Masonry | ~> 0.6 |
INTULocationManager | ~> 4.0 |
BlocksKit | ~> 2.2 |
使用两行代码在你的 iOS 应用中召唤 Uber。
#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];
.xcworkspace
文件(不是 .xcodeproj
)。如果手机已安装 Uber 应用,则轻按任何 Uber 服务按钮将使用已设置的适当参数调用它。否则将启动 Uber 移动网站。
要使用此库,您需要一个有效的 Uber 服务器令牌。您可以在这里获取: https://developer.uber.com
为了与 iOS 9 兼容,请将以下方案添加到应用程序的 info.plist
中 rapide regard sur les modifications des schemes URL iOS 9
<key>LSApplicationQueriesSchemes</key>
<array>
<string>uber</string>
</array>
#import <GPUberViewController.h>
传递您的 Uber 服务器令牌 进行身份验证。
GPUberViewController *uber = [[GPUberViewController alloc] initWithServerToken:@"your_server_token"];
您可以将所需的接送点和目的地坐标作为 CLLocationCoordinate2D 结构传递。
// example: from Boston South Station to Fenway Park
uber.startLocation = CLLocationCoordinate2DMake(40.7471787,-73.997494);
uber.endLocation = CLLocationCoordinate2DMake(40.712774,-74.006059);
如果您省略了startLocation
,GPUberView将尝试根据用户当前的位置来确定。对于iOS 8.0及以上版本,这需要您在应用程序的Info.plist
文件中添加NSLocationWhenInUseUsageDescription
密钥。[更多信息请点击此处](https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW26)。该值应是一个非常简短的字符串,解释为什么您的应用程序需要位置信息(例如:“Uber需要确定您的上车位置。”)。
如果您省略了endLocation
,GPUberView将无法计算价格估算,但仍然可以显示预估的上车时间。
注意:如果您提供了上车和下车位置,请确保两者之间的距离不是很长。[大多数Uber产品](http://blog.uber.com/tag/uberchopper/)都不能开车带您从旧金山到纽约。
您还可以传入上车和下车的点的人 readable 名称。这些标签将在Uber应用启动后显示为上车和下车标签。如果未提供,GPUberView(或Uber应用程序本身)将尝试自动确定这些位置。
uber.startName = @"South Station";
uber.endName = @"Fenway Park";
将您的Uber 客户端ID添加到注册中以获得Uber积分。您可以在以下位置获取它:[https://developer.uber.com](https://developer.uber.com)
uber.clientId = @"your_client_id";
[uber showInViewController:self];
GPUberView遵守MIT许可协议。有关更多信息,请查看LICENSE文件。