为什么在尝试从我的 ios 应用中获取 google+ 个人资料图片时会收到错误代码 403?

use*_*930 2 google-api ios swift google-console-developer google-signin

我有一个用户的谷歌 ID,我想在我的应用程序中显示他的谷歌个人资料照片。在我的swift代码中,我尝试使用必要的信息获取 json(基于此答案/sf/answers/1576829131/)。这是我的代码:

 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)
                }

        }
Run Code Online (Sandbox Code Playgroud)

但作为回应,我收到此错误:

    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.";
    };
Run Code Online (Sandbox Code Playgroud)

我仔细浏览了我的谷歌开发者控制台,我没有设置任何 IP 限制。这是到目前为止的样子:

我正在使用这里的 api 密钥:

在此处输入图片说明

在此处输入图片说明

如您所见,这里没有域限制:

在此处输入图片说明

这个奇怪的错误可能是什么原因?

小智 5

在 Google Developers Console 中删除 API 密钥的 iOS 包标识符限制。捆绑标识符限制仅在您使用Google 客户端库时有效