Closed varunsdcet closed 6 years ago
How we fetch product and sandbox url . But not geting product . Aceess token also nil Optional(<NSHTTPURLResponse: 0x600000231700> { URL: https://api.uber.com/v1.2/products?latitude=37.787654&longitude=-122.40276 } { Status Code: 401, Headers { Connection = ( "keep-alive" ); "Content-Length" = ( 63 ); "Content-Type" = ( "application/json" ); Date = ( "Mon, 20 Nov 2017 11:54:43 GMT" ); Server = ( nginx ); "Strict-Transport-Security" = ( "max-age=604800" ); "X-Content-Type-Options" = ( nosniff ); "X-XSS-Protection" = ( "1; mode=block" ); } }) [] 2017-11-20 17:25:11.845632+0530 uber[13369:290147] Could not signal service com.apple.WebKit.WebContent: 113: Could not find specified service
let loginManager = LoginManager()
loginManager.login(requestedScopes:[.request,.profile], presentingViewController: self, completion: { accessToken , error in // var a = UserProfile(from: <#T##Decoder#>) if TokenManager.save(accessToken: accessToken!){ // Success // self.showMessage("Token Saved!") } else { // self.showMessage("unable to Saved!") // Unable to save } let token1 = TokenManager.fetchToken() print(token1?.tokenString ?? "") //self.getData()// let ridesClient = RidesClient() let pickupLocation = CLLocation(latitude: 37.787654, longitude: -122.402760) let dropoffLocation = CLLocation(latitude: 37.775200, longitude: -122.417587) let builder = RideParametersBuilder() builder.pickupLocation = pickupLocation builder.dropoffLocation = dropoffLocation ridesClient.fetchProducts(pickupLocation: pickupLocation) { products, response in print(response.response) print(products) guard let uberX = products.filter({$0.productGroup == .uberX}).first else { // Handle error, UberX does not exist at this location return } builder.productID = uberX.productID ridesClient.fetchRideRequestEstimate(parameters: builder.build(), completion: { rideEstimate, response in guard let rideEstimate = rideEstimate else { // Handle error, unable to get an ride request estimate return } builder.upfrontFare = rideEstimate.fare self.ridesClient.requestRide(parameters: builder.build(), completion: { ride, response in guard let ride = ride else { // Handle error, unable to request ride return } // Ride has been requested! }) }) } // Completion block. If accessToken is non-nil, you’re good to go // Otherwise, error.code corresponds to the RidesAuthenticationErrorType that occured })
Closing in favor of your question on StackOverflow: https://stackoverflow.com/questions/47390809/uber-not-fetch-product
How we fetch product and sandbox url . But not geting product . Aceess token also nil Optional(<NSHTTPURLResponse: 0x600000231700> { URL: https://api.uber.com/v1.2/products?latitude=37.787654&longitude=-122.40276 } { Status Code: 401, Headers { Connection = ( "keep-alive" ); "Content-Length" = ( 63 ); "Content-Type" = ( "application/json" ); Date = ( "Mon, 20 Nov 2017 11:54:43 GMT" ); Server = ( nginx ); "Strict-Transport-Security" = ( "max-age=604800" ); "X-Content-Type-Options" = ( nosniff ); "X-XSS-Protection" = ( "1; mode=block" ); } }) [] 2017-11-20 17:25:11.845632+0530 uber[13369:290147] Could not signal service com.apple.WebKit.WebContent: 113: Could not find specified service
let loginManager = LoginManager()