Ios 谷歌地图GMSPanoramaView api被阻止
我得到了这个错误:Ios 谷歌地图GMSPanoramaView api被阻止,ios,swift,xcode,google-maps,panoramas,Ios,Swift,Xcode,Google Maps,Panoramas,我得到了这个错误: This application has been blocked by the Google Maps API. This might be because of an incorrectly registered key. 当我试图设置谷歌地图全景街景。如果我显示一个常规的地图视图,它会正常工作,看起来密钥注册正确 我完全按照谷歌文档的指示进行全景视图: import UIKit import GoogleMaps class ViewController: UIVi
This application has been blocked by the Google Maps API. This might be because of an incorrectly registered key.
当我试图设置谷歌地图全景街景。如果我显示一个常规的地图视图,它会正常工作,看起来密钥注册正确
我完全按照谷歌文档的指示进行全景视图:
import UIKit
import GoogleMaps
class ViewController: UIViewController, GMSMapViewDelegate {
override func loadView() {
let panoView = GMSPanoramaView(frame: .zero)
self.view = panoView
panoView.moveNearCoordinate(CLLocationCoordinate2D(latitude: -33.732, longitude: 150.312))
}
}
有什么想法吗?对我来说,解决方案是我需要将我在谷歌云平台上的项目链接到一个计费帐户 一旦我这样做,街景开始正常工作
标准的Google地图在没有账单账户的情况下运行良好,这让我一开始感到困惑。您需要为此对象配置委托。比如:
import UIKit
import GoogleMaps
class ViewController: UIViewController, GMSMapViewDelegate {
override func loadView() {
let panoView = GMSPanoramaView(frame: .zero)
panoView.delegate = self
self.view = panoView
panoView.moveNearCoordinate(CLLocationCoordinate2D(latitude: -33.732, longitude: 150.312))
}
}
extension ViewController: GMSPanoramaViewDelegate {
func panoramaView(_ view: GMSPanoramaView, error: Error, onMoveNearCoordinate coordinate: CLLocationCoordinate2D) {
print("error: \(error.localizedDescription)")
}
}