菜鸟教程小白 发表于 2022-12-12 22:11:17

ios - Google 自定义搜索 API 返回访问未配置(iOS 应用)


                                            <p><p>阅读所有类似的帖子,但找不到解决方案。</p>

<p>NSURLConnection:</p>

<pre><code>&lt;NSURLConnection: 0x178004020&gt; { request: &lt;NSURLRequest: 0x178003ff0&gt; { URL: https://www.googleapis.com/customsearch/v1?key=&amp;cx=&amp;q= } }
</code></pre>

<p>回复:</p>

<pre><code>{
    error =   {
      code = 403;
      errors =         (
                        {
                domain = usageLimits;
                message = &#34;Access Not Configured. Please use Google Developers Console to activate the API for your project.&#34;;
                reason = accessNotConfigured;
            }
      );
      message = &#34;Access Not Configured. Please use Google Developers Console to activate the API for your project.&#34;;
    };
}
</code></pre>

<p>我访问了 Google Developers Console,并为我的项目探索了自定义搜索 API。对应这个网址:</p>

<pre><code>https://console.developers.google.com/project//apiui/api/customsearch/method/search.cse.list
</code></pre>

<p>它成功运行并显示了这个请求(连同正确的结果):</p>

<pre><code>GET https://www.googleapis.com/customsearch/v1?q=&amp;cx=&amp;key={YOUR_API_KEY}

X-JavaScript-User-Agent:Google APIs Explorer
</code></pre>

<p>所以我从这个成功中得出结论:</p>

<ol>
<li> 值正确</li>
<li> 值与我的项目相关联,因为我从我的项目中“探索”了它</li>
</ol>

<p>我确认自定义搜索 API 确实已开启</p>

<p>我还在该项目下方的 API 访问页面上验证了我正在使用简单 API 访问部分中列出的正确 APIkey 和 iOS 应用程序(捆绑 ID)。</p>

<p>我不确定从这里去哪里解决这个问题并让它正常工作。</p>

<p>任何帮助将不胜感激!</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>仔细检查您的 Google Developers 控制台是否显示为以下屏幕(对于您自己的模块,我的是谷歌地图)。 </p>

<p> <img src="/image/Z2a4s.png" alt="enter image description here"/> </p>

<p> <img src="/image/C1XsI.png" alt="enter image description here"/> </p>

<p>如果您确定开发者控制台端的一切都正确,但您仍然看到错误,请从控制台中删除它并创建一个新的,然后重试。是的,这很奇怪,但我之前也遇到过类似的问题,我通过 <strong>delete and recreate</strong> 解决了这个问题。 </p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - Google 自定义搜索 API 返回访问未配置(iOS 应用),我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/23463449/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/23463449/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - Google 自定义搜索 API 返回访问未配置(iOS 应用)