2016-04-17 78 views
1

面對使用xcode v7.2.1和ios模擬器v9.2的問題。 我面臨的問題是,當我運行應用程序時,地圖顯示爲空白。 網格線出現一秒鐘,然後它只是空白。我試過尋找解決方案,但沒有找到任何工作。ios 9模擬器中的mapView爲空白

import UIKit 
import MapKit 

class ViewController: UIViewController, MKMapViewDelegate { 
@IBOutlet var map: MKMapView! 

override func viewDidLoad() { 
    super.viewDidLoad() 


    //maps integration 
    let longitude : CLLocationDegrees = 17.486374 
    let latitude : CLLocationDegrees = 78.543345 
    let longDelta : CLLocationDegrees = 0.1 
    let latDelta : CLLocationDegrees = 0.1 
    let location : CLLocationCoordinate2D = CLLocationCoordinate2DMake(latitude, longitude) 
    let span : MKCoordinateSpan = MKCoordinateSpanMake(latDelta, longDelta) 
    let region : MKCoordinateRegion = MKCoordinateRegionMake(location, span) 
    map.setRegion(region, animated: true) 




} 

override func didReceiveMemoryWarning() { 
    super.didReceiveMemoryWarning() 
    // Dispose of any resources that can be recreated. 
} 

}

it's just a picture of the simulator once the app is run. This is what i meant when i said blank incase it wasn't clear.

提前感謝!

+0

我認爲這可能會讓您的經緯度值產生混淆。現在,您經歷的經緯度將帶您到斯瓦爾巴羣島和揚馬延島(挪威北部不遠處的一些偏遠島嶼),但如果您更改經緯度,您就可以在印度得到海得拉巴。 – TylerTheCompiler

+0

您的跨度太小。嘗試:0.15D爲兩個latDelta和0.26爲longDelta。如果它不起作用,請嘗試增加值。它會渲染。但隨着你現在提供的跨度,它變得非常大,看起來空白。我剛剛測試過這個。 – Brandon

+1

@DrBeardface非常感謝。但即使它是偏遠島嶼,爲什麼它是空白的?是因爲他們沒有被映射? – baconSoda

回答

0

我認爲你可能會混淆你的經度和緯度值。現在,您經歷的經緯度將帶您到斯瓦爾巴羣島和揚馬延島(挪威北部不遠處的一些偏遠島嶼),但如果您更改經緯度,您就可以在印度得到海得拉巴。