2014-12-19 8 views
5

Zintegrowałem Google URL-Shorten API w mojej aplikacji na iOS tylko do celów testowych. Identyfikator pakietu mojej aplikacji został dodany przeze mnie na liście Authorized iOS Applications w celu wysłania żądania.accessNotConfigured: Google URL Skróć API na symulatorze iOS

Ale ilekroć wysłać HTTPPOST żądanie przy użyciu NSURLRequest, pojawia się następujący błąd w odpowiedzi 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." 
} 
} 

nie mogę dowiedzieć się, jak rozwiązać ten problem. Jeden przypuszczenie Zrobiłem to „może być muszę używać API na App Online”

Wspieranie odniesienie do Domyślam się od Dokumentacja 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. 

Odpowiedz

1

jako błąd wskazuje, że nie został prawidłowo skonfigurowany dostęp do API lub nie uwierzytelniasz aplikacji.

Authorizing requests and identifying your application

każde żądanie aplikacja wysyła do interfejsu API Google do skracania URL potrzebuje do identyfikacji aplikacji do Google. Istnieją dwa sposoby identyfikacji aplikacji: przy użyciu tokenu OAuth 2.0 (który również autoryzuje żądanie) i/lub przy użyciu klucza API aplikacji. Oto jak określić, które z tych opcji, aby użyć:

Musisz skonfigurować projekt w Google Developer console umożliwić URL Shorter API i użyć klucza API, żeby go OAuth2 dostęp.

0

Możliwe, że przegapiłeś podanie kluczy API. Możesz zobaczyć, jak przekazać klucz here.

3

Po skonfigurowaniu klucza API NIE podawaj opcjonalnego identyfikatora pakunku systemu iOS, chyba że korzystasz z protokołu OAuth 2.0. Google API Keys for iOS Usage

Wpadłem na ten sam błąd, usunąłem identyfikator pakunku i wyczyściłem 403, wciąż używając klucza API na żądanie HTTP HTTP NSURLSession.

Możesz usunąć błąd, przechodząc do konsoli programistów Google, klikając "Poświadczenia" pod APIs & auth, a następnie klikając nazwę klucza API. Otrzymasz wtedy ekran, na którym możesz usunąć identyfikator pakietu iOS powiązany z kluczem API. Następnie kliknij przycisk zapisu i ponów test.

+0

to po prostu działa! – Dashrath

Powiązane problemy