I am trying to integrate the Uber Widget in my iPhone application (made in Xcode Version 7.3.1
with language Objective C
). Put all things as described in Uber-ride-request-widget and Github of Uber rides-ios-sdk . Created all the credential which Uber need like CLIENT_ID
, Service Token
in Uber Developer Account . I have installed pod for Uber as they said:
use_frameworks!
target 'My_Project_Name' do
pod 'UberRides'
end
and ran pod install
and successfully installed the pod
and then
Set info.plist
as they described:
<key>UberClientID</key>
<string>MY_APP_CLIENT_ID</string>
<key>UberDisplayName</key>
<string>MY_APP_NAME</string>
and
<key>UberCallbackURIs</key>
<array>
<dict>
<key>URIString</key>
<string>https://www.google.com</string>
<key>UberCallbackURIType</key>
<string>General</string>
</dict>
</array>
and also added following code in NSExceptionDomains
within NSAppTransportSecurity
keeping NSAllowsArbitraryLoads
to 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>
Now added following code in didFinishLaunchingWithOptions
in 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];
and Written following code to make the Uber Widget call:
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];
Now when I am running the app in Simulator[Version 9.3 (SimulatorApp-645.9 CoreSimulator-209.19)]
it is showing like the following:
But when running in device (iPhone 5s or 6 with iOS version 9.3.5) this is showing like this blank screen:
Can anyone tell me what is the cause behind it? Some days ago when I tested it was showing fine for device also then I was facing problem of passing the destination address, Now I am facing the problem not loading the Login Screen, Can anyone please suggest?
Sometimes, there can be a delay for the webview to fully load. It looks like there may be a loading spinner in your screenshot (next to the wifi icon). Please try again and see if you can wait for the page to finish loading.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.