我在我的应用程序中使用了 Core Date 和 iCloud,但是检索数据的速度太慢了。为了创建核心数据堆栈,我使用了 MagicalRecords 方法
[MagicalRecord setupCoreDataStackWithiCloudContainer:nil localStoreNamed:@"base"];
我可以检索不在主线程中的数据吗?加载需要很多时间。
最佳答案
只需使用 GCD。
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
[MagicalRecord setupCoreDataStackWithiCloudContainer:nil
localStoreNamed:@"base"];
dispatch_async(dispatch_get_main_queue(), ^{
// update your UI if necessary
});
});
关于ios - iCloud低速检索数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15806935/