XCode 9上的MKMapView崩溃

时间:2017-12-27 18:09:29

标签: swift mapkit mkmapview ios11 xcode9

我在项目XCode9中使用@IBOutlet weak var mapView: MKMapView!。当控件进入第iOS 11行时,我的应用程序崩溃了。我以编程方式尝试过,但面临同样的问题。它在iPhone 5(iOS 10.3.3)模拟器上运行,但当我在Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty array' *** First throw call stack: (0x1cf93b3d 0x1c21b067 0x1cea398b 0x23b1c091 0x23b1b909 0x23b1b0a5 0x23b1c5b3 0x23b1c5e7 0x23b7afab 0x23b7d2eb 0xf9e453 0xf9ef4f 0x23b7d279 0x27e65653 0x27e6623f 0x227d06ef 0x227d03a5 0x226960d3 0x227d06ef 0x227d0647 0x227d03a5 0x22695633 0x22513adf 0x222f2abb 0x221c5b9b 0x221c5ad9 0x22b14599 0x2292cb33 0x2292c961 0x2292cbd9 0x221c5d31 0x22279b59 0x22279a4d 0x22278f11 0x222789ad 0x2227858d 0x2227850d 0x221c3483 0x1fe1bcb7 0x1fe0fd77 0x1fe0fc05 0x1fd9e839 0x1fdbcfdb 0x1fdbdb2f 0x1cf4f803 0x1cf4da55 0x1cea11cf 0x1cea0fd1 0x2222ee2d 0x22229a53 0x4bfb0 0x1c68e4eb) libc++abi.dylib: terminating with uncaught exception of type NSException 上运行它时,它会崩溃。当我删除mapView的插座时,它也能在设备上正常工作。

class StampViewController: UIViewController, MKMapViewDelegate, CLLocationManagerDelegate {

@IBOutlet weak var markLightButton: UIButton!
@IBOutlet weak var markDarkButton: UIButton!
@IBOutlet weak var placesButton: UIButton!
@IBOutlet weak var mapView: MKMapView!

let locationManager = CLLocationManager()

override func viewDidLoad() {
    super.viewDidLoad()
    //    self.locationManager.requestAlwaysAuthorization()
    //    self.locationManager.requestWhenInUseAuthorization()
    //    if CLLocationManager.locationServicesEnabled() {
    //        locationManager.delegate = self
    //        locationManager.desiredAccuracy = 
            kCLLocationAccuracyNearestTenMeters
    //        locationManager.startUpdatingLocation()
    //    }
    //    mapView.delegate = self
}

这是我在控制台上获得的。谢谢你的建议。

master = tk.Tk()

variable = StringVar(master)
variable.set(cities_list[0]) # default value

w = OptionMenu(master, variable, *cities_list)
w.pack()

def ok():
    print ("value is:" + variable.get())
    return  variable.get()
    window.destroy()


button = Button(master, text="OK", command=ok)
button.pack()

mainloop()


v_list = variable.get().split('-')

0 个答案:

没有答案