嘿,如何获得大量信息,如 1000 行而不会卡住?我试试这个:
dispatch_async(dispatch_get_main_queue(), {
//here code
})
但是当我执行请求self.context.executeFetchRequest
时它返回我fatal error: unexpectedly found nil while unwrapping an Optional value
。我有一个错误,我必须self.
在函数前面添加。
let queue:dispatch_queue_t = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)
dispatch_async(queue, { () -> Void in
//code
})
但我也得到同样的错误......
我使用 NSFetchRequest 并将结果添加到 NSArray 中,然后将结果循环到 for 循环中,并在循环中将结果排序到字典中。