2017-03-20 37 views
0

我在我的項目中使用了這段代碼。我已經導入了UIKit和GoogleMaps,但是由於「使用未解析的標識符CLLocationCoordinate2D」而出現錯誤。請幫我解決這個問題爲什麼我使用未解析的標識符'CLLocationCoordinate2D'出現錯誤?

類的ViewController:UIViewController的{

override func viewDidLoad() { 
    super.viewDidLoad() 
    let camera = GMSCameraPosition.camera(withLatitude: -33.86, longitude: 151.20, zoom: 6.0) 
let mapView = GMSMapView.map(withFrame: CGRect.zero, camera: camera) 
    let view = mapView 

    // Creates a marker in the center of the map. 
    let marker = GMSMarker() 
    marker.position = CLLocationCoordinate2D(latitude: -33.86, longitude: 151.20) 
    marker.title = "Sydney" 
    marker.snippet = "Australia" 
    marker.map = mapView 
} 

}

回答

2

您需要import對於該CoreLocation框架。

import CoreLocation 
0

對於訪問CLLocationCoordinate2D你必須要 import CoreLocation 您的文件中,那麼你可以能夠訪問所有CoreLocation框架功能。

相關問題