【发布时间】:2014-08-04 20:45:09
【问题描述】:
所以我使用字典从核心数据中获取属性。它抓住它就好了。但是,当我尝试获取单个返回的属性并将其分配给 navigationitem.title 时,它会引发一些令人讨厌的错误。我在这里错过了什么吗.. 它实际上并没有在控制台中输出错误消息,而是给了我这个:
Thread 1: EXC_BREAKPOINT(code+exc_I386_BPT.....
在这条线上。
0x10707a5f3: nopw %cs:(%rax,%rax)
也是它的说法
0 swift_dynamicCastObjCClassUnconditional
代码:
override func viewDidLoad() {
super.viewDidLoad()
let appDel:AppDelegate = UIApplication.sharedApplication().delegate as AppDelegate
let context:NSManagedObjectContext = appDel.managedObjectContext
let frequest = NSFetchRequest(entityName: "Round")
frequest.propertiesToFetch = NSArray(object: "course")
frequest.returnsObjectsAsFaults = false
frequest.returnsDistinctResults = true
frequest.resultType = NSFetchRequestResultType.DictionaryResultType
var fetchedArray = context.executeFetchRequest(frequest, error: nil)
//this is the line that throw the error...why won't it let me set the title to the array of the single returned result?
self.navigationItem.title = fetchedArray[0]
println(fetchedArray)
}
【问题讨论】:
-
“一些讨厌的错误”?具体是什么错误?该错误的内容可能是一个很好的线索。
-
请提供您收到的具体错误消息,以便我们为您提供帮助。
-
请查看更新后的问题,谢谢