【发布时间】:2016-09-04 16:50:28
【问题描述】:
我正在开发的 iOS 应用中使用谷歌街景。我在 vc 中设置了 panoView,似乎当我输入某些美国地址时,我得到了一些但不是其他人的全景图像。对于我没有得到图像的位置,我会得到一个灰色的加载屏幕。我去常规谷歌并输入相同的确切地址,谷歌显示图像确实存在。为什么它对某些地址不起作用,而对其他地址却起作用?
这是一个地址,我确实得到了一张图片:
253 瓦特。 125 St, New York NY 10027 -坐标(纬度:40.809847,经度:-73.950378)
但是我得到一个灰色的地址加载屏幕:
150 W 225 St, Bronx NY 10463 -坐标(纬度:40.8754871,经度:-73.9137233)
我收到以下调试器错误消息:
1.移动近坐标(40.8754871,-73.9137233错误:操作无法完成。(com.google.maps.GMSPanoramaService错误0。)?。
我已经将我的方案设置为 Schemes>Edit Scheme>Options>AllowLocationSimulation>DefaultLocation>New York, NY, USA
有什么问题?
顺便说一句,我使用的是 Xcode 7.3.1
import UIKit
import GoogleMaps
class SearchController: UIViewController, GMSMapViewDelegate, GMSPanoramaViewDelegate {
@IBOutlet weak var viewStreet: UIView!
var panoView: GMSPanoramaView!
var buildingLat: CLLocationDegrees?
var buildingLon: CLLocationDegrees?
var panoramaID: String?
let placesClient = GMSPlacesClient()
func viewDidLoad() {
super.viewDidLoad()
panoView = GMSPanoramaView(frame: CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height))
panoView.delegate = self
panoView.moveNearCoordinate(CLLocationCoordinate2D(latitude: buildingLat!, longitude: buildingLon!))
viewStreet.addSubview(panoView)
viewStreet.sendSubviewToBack(panoView)
print("\nlat: \(buildingLat)\nlon: \(buildingLon)\n")
}
// MARK: - GMSPanoramaViewDelegate
func panoramaView(view: GMSPanoramaView, error: NSError, onMoveNearCoordinate coordinate: CLLocationCoordinate2D) {
print("\n1.Moving near coordinate (\(coordinate.latitude),\(coordinate.longitude) error: \(error.localizedDescription)?\n")
}
func panoramaView(view: GMSPanoramaView, error: NSError, onMoveToPanoramaID panoramaID: String) {
print("\n2.Moving to PanoID \(panoramaID) error: \(error.localizedDescription)??\n")
}
func panoramaView(view: GMSPanoramaView, didMoveToPanorama panorama: GMSPanorama?) {
print("\n3.Moved to panoramaID: \(panorama!.panoramaID) " +
"coordinates: (\(panorama!.coordinate.latitude),\(panorama!.coordinate.longitude))???\n")
self.panoramaID = panorama!.panoramaID
}
}
【问题讨论】:
标签: ios swift xcode google-api google-street-view