2016-09-01 3 views
0

uber를 내 응용 프로그램에 통합하기 위해 UBER iOS SDK 설명서를 따르고 있습니다. 아래 보이는UBER iOS SDK - 401 오류

https://github.com/uber/rides-ios-sdk

나는 내 애플 리케이션에 "라이드 요청 버튼"을 통합하기 위해 노력하고 내가 문서

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]; 
    } 
}]; 

블록 UBSDKResponse (response.response)에서 붙여 넣기 예제 코드를 복사

<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"; 
} } 

내 응용 프로그램에서 info.plist 파일에 UberClient ID를 구성했습니다. 401 응답을 얻기 위해 내가 무엇을 놓치고 있는지 확실하지 않습니다.

감사합니다.

답변

1

Info.plist에 서버 토큰을 추가하기 만하면됩니다.

복사에이 조각 당신의 Info.plist (마우스 오른쪽 버튼을 클릭하고 열기로> 소스 코드 해당)에서 서버 토큰과 [Your Server Token]을 대체하여 dashboard (당신이 당신의 클라이언트 ID에 해당하는 토큰 서버를 사용하십시오).

<key>UberServerToken</key> 
<string>[Your Server Token]</string> 

희망이 있습니다.

+0

이 부분은 Uber 문서에 없습니다. 지시 된대로 클라이언트 ID를 추가했지만 서버 토큰은 추가하지 않았습니다. init 메소드에서 토큰을 전달하려고 시도했지만 작동하지 않았습니다. 그것이 .plist 파일에서 작동하도록했습니다. – slysid