2014-12-19 2 views
5

iOS 응용 프로그램에 Google URL-Shorten API을 테스트 목적으로 통합했습니다. 내 앱 번들 ID가 Authorized iOS Applications 목록에 나에게 추가되어 요청을 보냅니다. 내가 NSURLRequest를 사용하여 HTTPPOST 요청을 보낼 때마다accessNotConfigured : Google URL iOS 시뮬레이터의 API 단축

, 나는 응답 JSON에 다음과 같은 오류가 발생합니다 :

{ 
"error": { 
    "errors": [ 
    { 
    "domain": "usageLimits", 
    "reason": "accessNotConfigured", 
    "message": "Access Not Configured. The API is not enabled for your project, or there is a per-IP or per-Referer restriction configured on your API key and the request does not match these restrictions. Please use the Google Developers Console to update your configuration.", 
    "extendedHelp": "https://console.developers.google.com" 
    } 
    ], 
    "code": 403, 
    "message": "Access Not Configured. The API is not enabled for your project, or there is a per-IP or per-Referer restriction configured on your API key and the request does not match these restrictions. Please use the Google Developers Console to update your configuration." 
} 
} 

나는이 문제를 해결하는 방법을 알아낼 수 없습니다. 내가 만든 하나의 추측이 오류가 제대로에 대한 액세스를 구성하지 않은 상태로 내 생각을 참조하여 지원

은 API 문서에서

If your application accesses APIs directly from iOS, you will need the application's Bundle ID and (optionally) its Apple App Store ID: 

The application's Bundle ID is the bundle identifier as listed in the app's .plist file. For example: com.example.myapp. 
The application's App Store ID is in the app's iTunes URL so long as the app was published in the Apple iTunes App Store. For example, in the app URL http://itunes.apple.com/us/app/google+/id447119634, the App Store ID is 447119634. 

답변

1

입니다 "나는 온라인 응용 프로그램에서 API를 사용 할 수 있습니다" API를 사용하거나 앱을 인증하지 않았습니다.

모든

Authorizing requests and identifying your application

응용 프로그램은 Google에 응용 프로그램을 식별 할 필요가 구글 URL Shortener를의 API로 전송하는 요청합니다. 은 OAuth 2.0 토큰 ( 도 요청 권한 부여) 및/또는 애플리케이션의 API 키 사용 중 두 가지 방법으로 애플리케이션을 식별 할 수 있습니다. 여기 은 사용하는 옵션을 결정하는 방법은 다음과 같습니다

당신은 Google Developer console에서 프로젝트를 설정해야

URL Shorter API을 가능하게하고, 또는 OAuth2를 액세스하기 위해 API 키 중 하나를 사용하십시오.

0

API 키를 놓친 것 같습니다. here 키를 전달하는 방법을 볼 수 있습니다.

3

OAuth 2.0을 사용하지 않는 경우 API 키를 설정할 때 선택적인 iOS 번들 ID를 제공하지 마세요. Google API Keys for iOS Usage

동일한 실수로 인해 번들 ID를 제거하고 NSURLSession과 함께 HTTP 게시 요청에서 API 키를 사용하면서 403을 삭제했습니다.

Google 개발자 콘솔에 액세스하고 & 인증의 API에서 '자격증 명'을 클릭 한 다음 API 키 이름을 클릭하여 실수를 제거 할 수 있습니다. 그런 다음 API 키와 연결된 iOS 번들 ID를 삭제할 수있는 화면이 나타납니다. 그런 다음 저장 버튼을 클릭하고 다시 테스트하십시오.

+0

그냥 작동합니다! – Dashrath