i following uber ios sdk documentation integrate uber app.
https://github.com/uber/rides-ios-sdk
i trying integrate "ride request button" app , copy pasted example code documentation
ubsdkriderequestbutton *button = [[ubsdkriderequestbutton alloc] init]; [self view] addsubview:button]; ubsdkridesclient *ridesclient = [[ubsdkridesclient alloc] init]; cllocation *pickuplocation = [[cllocation alloc] initwithlatitude: 37.787654 longitude: -122.402760]; cllocation *dropofflocation = [[cllocation alloc] initwithlatitude: 37.775200 longitude: -122.417587]; __block ubsdkrideparametersbuilder *builder = [[ubsdkrideparametersbuilder alloc] init]; builder = [builder setpickuplocation: pickuplocation]; builder = [builder setdropofflocation: dropofflocation]; [ridesclient fetchcheapestproductwithpickuplocation: pickuplocation completion:^(ubsdkuberproduct* _nullable product, ubsdkresponse* _nullable response) { if (product) { builder = [builder setproductid: product.productid]; button.rideparameters = [builder build]; [button loadrideinformation]; } }];
the block ubsdkresponse (response.response) looks below
<nshttpurlresponse: 0x15c6c1eb0> { url: https://sandbox-api.uber.com/v1/products?latitude=37.787654&longitude=-122.40276 } { status code: 401, headers { connection = "keep-alive"; "content-length" = 63; "content-type" = "application/json"; date = "thu, 01 sep 2016 21:39:12 gmt"; server = nginx; "strict-transport-security" = "max-age=0"; "x-content-type-options" = nosniff; "x-uber-app" = "uberex-sandbox, migrator-uberex-sandbox-optimus"; "x-xss-protection" = "1; mode=block"; } }
i have configured uberclient id in app in info.plist file. not sure missing 401 response.
thanks
you need add server token info.plist.
copy snippet info.plist
(right click , select open > source code) , replace [your server token]
server token dashboard (make sure use server token corresponding client id).
<key>uberservertoken</key> <string>[your server token]</string>
hope helps!
Comments
Post a Comment