如何在我的代码中修复EXC_BAD_ACCESS(code = 1,address = 0x10)

时间:2015-07-29 15:45:09

标签: swift exc-bad-access

我有一个问题,当我运行我的代码时,它给我线程1:EXC_BAD_ACCESS(代码= 1,地址= 0x10)

@IBAction func sendMessage(sender:AnyObject){

var placemark = CLPlacemark()

var messageVC = MFMessageComposeViewController()

var locaiton = placemark.country //Thread was here

messageVC.recipients = ["Enter tel-nr"]
messageVC.messageComposeDelegate = self;

self.presentViewController(messageVC, animated: false, completion: nil)


self.locationManager.delegate = self

self.locationManager.desiredAccuracy = kCLLocationAccuracyBest

self.locationManager.requestWhenInUseAuthorization()

self.locationManager.startUpdatingLocation()

messageVC.body = (locaiton)

}

希望你能帮忙!

约什

1 个答案:

答案 0 :(得分:0)

查看有关如何使用CLPlacemark的帖子: Swift - CLGeocoder reverseGeocodeLocation completionHandler closure

CLPlacemarks不是直接实例化的,而是作为反向地理编码操作的结果生成的。