1

Bazı kullanıcıların google iD'lerini kullanıyorum ve google profil fotoğrafımı uygulamamda görüntülemek istiyorum. swift kodumda jsonu gerekli bilgilerle getirmeye çalışıyorum (bu cevaba göre https://stackoverflow.com/a/22526130/3766930). Bu benim kodudur:Neden ios uygulamasından google + profil görüntüsünü almaya çalışırken hata kodu 403'ü alıyorum?

Alamofire.request(.GET, "https://www.googleapis.com/plus/v1/people/10263...4252?key=AI...Oo") 
      .responseJSON { response in 

       print(response) 
       switch response.result { 
       case .Success: 

        dispatch_async(dispatch_get_main_queue(),{ 

         if let jsonData = response.result.value as? [[String: AnyObject]] { 
          print(jsonData) 
         } 

        }) 
       case .Failure(let error): 
        print("SWITCH ERROR") 
        print(error) 
       } 

     } 

ama yanıt olarak bu hatayı alıyorum:

error =  { 
     code = 403; 
     errors =   (
         { 
       domain = usageLimits; 
       extendedHelp = "https://console.developers.google.com"; 
       message = "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 API key configuration if request from this IP or referer should be allowed."; 
       reason = ipRefererBlocked; 
      } 
     ); 
     message = "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 API key configuration if request from this IP or referer should be allowed."; 
    }; 

benim google geliştiriciler konsol üzerinden dikkatlice gitti ve herhangi bir IP kısıtlamaları kurmak gerekmez.

: Gördüğünüz gibi

enter image description here

enter image description here

burada hiçbir etki alanı sınırlaması yoktur: Ben buradan API anahtarı kullanıyorum

: Bu şimdiye kadar böyle görünüyor

enter image description here

Bu garip hatanın nedeni ne olabilir?

+0

http://stackoverflow.com/questions/36209983/how-to-fetch-users-profile-photo-from-google-and-not-from-google. Lütfen sorunuza sadece bir kez sorun. –

cevap

1

Google Developers Console'daki API anahtarı için iOS paket tanımlayıcısı kısıtlamalarını kaldırın. Paket tanımlayıcı kısıtlamaları, yalnızca Google client libraries'u kullandığınızda çalışır.

İlgili konular