我在我正在开发的iOS应用中使用谷歌街景。我在vc中设置了一个panoView,似乎当我输入某些美国地址时,我会得到一些pano图像,但不是其他人。对于我没有获得图像的位置,我得到一个灰色加载屏幕。我去常规谷歌并输入相同的确切地址,谷歌显示图像确实存在。为什么它不适用于某些地址,但它适用于其他地址?
这是我得到图像的地址:
253 w。 125 St,New York NY 10027 -coordinates(lat:40.809847,lon:-73.950378)
但是我得到一个灰色加载屏幕的地址:
150 W 225 St,Bronx NY 10463 -coordinates(lat:40.8754871,lon:-73.9137233)
我收到调试器错误消息:
1.在坐标附近移动(40.8754871,-73.9137233错误:操作无法完成。(com.google.maps.GMSPanoramaService错误0。)?.
我已经将我的Scheme设置为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
}
}
答案 0 :(得分:0)
moveNearCoordinate(坐标:CLLocationCoordinate2D,radius:Uint)
//Inside my viewDidLoad on the 4th line
panoView.moveNearCoordinate(CLLocationCoordinate2D(latitude: buildingLat!, longitude: buildingLon!), radius: 100)
您可以使用半径来查看最适合您的内容