我正在尝试将Uber Widget集成到我的iPhone应用程序中(使用语言Xcode Version 7.3.1
在Objective C
中制作)。按照Uber-ride-request-widget中的描述放置所有内容
和Github of Uber rides-ios-sdk。在Uber Developer Account中创建了优步所需的所有凭据CLIENT_ID
,Service Token
。我已经为Uber安装了pod,因为他们说:
use_frameworks!
target 'My_Project_Name' do
pod 'UberRides'
end
并运行pod install
并成功安装了pod
然后
按照描述设置info.plist
:
<key>UberClientID</key>
<string>MY_APP_CLIENT_ID</string>
<key>UberDisplayName</key>
<string>MY_APP_NAME</string>
和
<key>UberCallbackURIs</key>
<array>
<dict>
<key>URIString</key>
<string>https://www.google.com</string>
<key>UberCallbackURIType</key>
<string>General</string>
</dict>
</array>
并在NSExceptionDomains
NSAppTransportSecurity
内NSAllowsArbitraryLoads
保留true
至 <key>uber</key>
<dict>
<key>NSExceptionRequiresForwardSecrecy</key>
<false/>
<key>NSIncludesSubdomains</key>
<true/>
</dict>
<key>uberauth</key>
<dict>
<key>NSExceptionRequiresForwardSecrecy</key>
<false/>
<key>NSIncludesSubdomains</key>
<true/>
</dict>
didFinishLaunchingWithOptions
现在在AppDelegate
// China based apps should specify the region
[UBSDKConfiguration setRegion:RegionDefault];
// If true, all requests will hit the sandbox, useful for testing
[UBSDKConfiguration setSandboxEnabled:YES];
// If true, Native login will try and fallback to using Authorization Code Grant login (for privileged scopes). Otherwise will redirect to App store
[UBSDKConfiguration setFallbackEnabled:NO];
中添加了以下代码
id<UBSDKRideRequesting> behavior = [[UBSDKRideRequestViewRequestingBehavior alloc] initWithPresentingViewController: self];
CLLocation *location4 = [[CLLocation alloc] initWithLatitude: 40.785695 longitude: -73.970208];
CLLocation *location2 = [[CLLocation alloc] initWithLatitude: 40.791251 longitude: -73.977149];
UBSDKRideParametersBuilder *builder = [[UBSDKRideParametersBuilder alloc] init];
[builder setPickupLocation:location4];
[builder setDropoffLocation:location2];
UBSDKRideParameters *parameters = [builder build];
UBSDKRideRequestButton *button1 = [[UBSDKRideRequestButton alloc] initWithRideParameters: parameters requestingBehavior: behavior];
button1.center=self.view.center;
[self.view addSubview:button1];
并编写以下代码以进行Uber Widget调用:
Simulator[Version 9.3 (SimulatorApp-645.9 CoreSimulator-209.19)]
现在,当我在{{1}}中运行应用时,它显示如下:
但是当在设备(iPhone 5s或iOS版本为9.3.5)中运行时,显示如下空白屏幕:
谁能告诉我背后的原因是什么?几天前,当我测试它显示设备正常,然后我遇到传递目的地地址的问题,现在我面临的问题是没有加载登录屏幕,任何人都可以建议吗?
答案 0 :(得分:0)
有时,webview可能会延迟完全加载。看起来您的屏幕截图中可能有一个加载微调器(在wifi图标旁边)。请再试一次,看看是否可以等待页面完成加载。