【发布时间】:2016-07-11 07:44:42
【问题描述】:
我从以前的视图控制器传递它。我想显示我保存在其他视图控制器中的数据。
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if (segue.identifier == "Beacons") {
let nav = segue.destinationViewController as! UINavigationController
let svc = nav.topViewController as! BeaconCharacteristicViewController
svc.selectedList = sender as! Beacons
}
和
var selectedList : Beacons!
这个代码由于某种原因出错。
我不使用主键,或者我必须使用它。
func loadproperties(){
let beacons = selectedList
let priority = DISPATCH_QUEUE_PRIORITY_DEFAULT
dispatch_async(dispatch_get_global_queue(priority, 0)) {
do{
try uiRealm.write({ () -> Void in
beacons.uuid = self.beaconUUID.text!
print("uuid = \(beacons.uuid)")
beacons.major = self.beaconMajor.text!
print("uuid = \(beacons.uuid)")
beacons.minor = self.beaonMinor.text!
print("uuid = \(beacons.uuid)")
uiRealm.add(beacons, update: true)
}
)
} catch {
print("error")
}
}
}
错误
Terminating app due to uncaught exception 'RLMException', reason: 'Realm accessed from incorrect thread.'
谢谢你:)))
【问题讨论】: