NSFetchedResultsController 初始获取缓慢
我正在开发我的第一个核心数据应用程序,并正在使用 NSFetchedResultsController
。我的问题是初始提取速度很慢,因此当我的表视图滑入视图时,由于调用初始提取并阻止 UI,因此会出现暂停。在所有示例中,我都看到初始获取是在 viewDidLoad 中完成的。我想知道是否可以在 NSOperation 中完成此操作以避免阻塞主线程?
我不确定如何以线程安全的方式将 NSFetchedResultsController
传递给 NSOperation
。这可能吗?如果不是,如何确保在 FRC 上进行初始获取时 UI 不会被阻塞。
I am working on my first core data app and am working with NSFetchedResultsController
. My issue is that the initial fetch is slow, so when my tableview slides into view there is a pause as the initial fetch is called and blocks the UI. In all the examples I have seen the initial fetch is done in viewDidLoad
. I was wondering if this can be done in an NSOperation
to avoid blocking the main thread?
What I'm not sure about is how to pass the NSFetchedResultsController
to to NSOperation
in a thread safe way. Is this possible? if not how does one go about ensure that the UI is not blocked when doing the initial fetch on the FRC.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论