我正在开发一个Cordova应用程序,我最近在iOS版本上安装了WKWebView(https://github.com/ionic-team/cordova-plugin-ionic-webview)。我正在使用Google Maps Place Autocomplete API,但如果我在输入字段中输入内容,它就会停止使用WKWebView给我这个错误:
This API project is not authorized to use this API. Please ensure this API is activated in the Google Developers Console:
https://console.developers.google.com/apis/api/places_backend?project=_
For more information on authentication and Google Maps Javascript API services please see: https://developers.google.com/maps/documentation/javascript/get-api-key
如果我回到正常的webview(UIWebView)它可以工作,所以我不认为这是一个代码问题,并且API项目完全有权使用API。我认为它与WKWebView中的CORS更改有关,但我真的不知道如何解决这个问题。
我自己解决了。我不知道这是怎么可能的,但我刚刚创建了一个新的API Key,这个新的密钥有效..:/