- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
使用 AFIncrementalStore,我尝试在 Controller 加载时获取实体的数据集。我在以前的 Controller 上有类似的工作,并尝试遵循该模式:
- (void)viewDidLoad
{
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
NSFetchRequest *fetchRequest = [NSFetchRequest fetchRequestWithEntityName:@"ItemCategory"];
fetchRequest.sortDescriptors = [NSArray arrayWithObject:[NSSortDescriptor sortDescriptorWithKey:@"name" ascending:YES selector:@selector(localizedStandardCompare:)]];
fetchRequest.returnsObjectsAsFaults = NO;
_fetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest managedObjectContext:[appDelegate managedObjectContext] sectionNameKeyPath:nil cacheName:nil];
_fetchedResultsController.delegate = self;
[_fetchedResultsController performFetch:nil];
}
然后,我尝试获取该数据来填充表格单元格中的 UIPickerView:
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSArray *rows = [_fetchedResultsController fetchedObjects];
NSLog(@"%@",rows);
...}
但是 fetchedObjects 返回一个空数组。我获取数据的唯一方法是在调用“fetchedObjects”之前重新获取,如下所示:
_fetchedResultsController.fetchRequest.resultType = NSManagedObjectResultType;
[_fetchedResultsController performFetch:nil];
但随后我又不必要地再次访问服务器。据我所知,两次获取都以完全相同的方式执行。那么为什么在数据填满之前需要进行第二次读取呢?
我的理论是,第二次获取实际上以某种方式使第一次获取的数据可用,而不是实际存储新数据,但我对 CoreData 的理解有点太不稳定,无法准确确定发生了什么。感谢您帮我解决这个问题!
编辑我想说的是,我尝试了类似问题的解决方案但无济于事:https://stackoverflow.com/a/11334792/380643
最佳答案
你记得在你的 table 上做一个 reloadData 吗?
关于ios - AFIncrementalStore viewDidLoad 中的空结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19885545/
我正在使用 AFIncrementalStore从网络服务获取数据并通过应用程序启动将其保存在 SQLite 数据库中。 Web 服务不遵循 REST 标准,所以我不能使用 AFRestClient
我一直在想,如果我将 AFIncrementalStore 和 Magical Record 结合起来,生活会是什么样子。我只是不知道如何将增量存储设置为魔法记录的存储。有谁知道如何执行这样的操作?
使用 AFIncrementalStore,我尝试在 Controller 加载时获取实体的数据集。我在以前的 Controller 上有类似的工作,并尝试遵循该模式: - (void)viewDid
我正在将 AFIncrementalStore 集成到我的项目中,但我很难弄清楚如何使关系发挥作用。 假设我有两个模型:文档和页面。一个文档有很多页(一对多)。每个模型彼此之间存在反比关系。 所以我可
我注意到自上次提交 AFIncrementalStore 以来已经快一年了,该项目是否仍然相关或正在维护? https://github.com/AFNetworking/AFIncrementalS
在我的 iOS 应用程序中,我试图从(RESTful)服务器获取和发布数据。我认为 RestKit 和 AFIncrementalStore 都是不错的选择。 但是,我还需要能够离线保存数据并在应用程
我有一个 iOS + Rails 3.1 应用程序,并且使用 AFIncrementalStore 进行客户端-服务器通信。 我已经根据本教程在我的 Rails 服务器上实现了 token 身份验证:
我查看了这两个框架并开始使用 Restkit,但我无法正常工作,而且我发现它非常复杂。更糟糕的是,我在网上找到的大多数信息都已过时,甚至是文档,所以现在我想知道是否应该改用 AFIncremental
假设我有一个使用 AFIncrementalStore 的核心数据模型,并且我有多个 REST API 端点用于检索该模型的对象列表。我可以覆盖 -requestForFetchRequest:wit
我在 Mac 应用程序中使用 App.net 消息传递 API,该应用程序使用 Core Data 和 AFIncrementalStore。我有一个Channel实体有几种不同的方式与 Users
我一直在按照使用 SQLite 的存储库中的示例代码将 AFIncrementalStore 合并到我们的应用程序中。后备商店。所有示例都使用带有 NSMainQueueConcurrencyType
我设置了AFIncrementalStore通过网络从 JSON 服务中获取对象并将其 persistentStore 设置为 SQLite 数据库。这一切都很好。 现在我想要做的是将对象带外添加到该
我正在尝试将 AFIncrementalStore 添加到数据库中已有大量数据的现有 Core Data 应用程序。我以为我已经添加了所有必要的东西,然后我启动了应用程序,在最初的获取请求中我收到了这
如何让 AFOAuth1Client 与 AFIncrementalStore 一起工作? 我能够使用 AFOAuth1Client 获取 AFOAuth1Token 的有效实例,并且能够将其保存到钥
AFIncrementalStore 似乎依赖于 AFHTTPClient,AFHTTPClient 在 AFNetworking 2.0 中不再可用?是否有适用于 AFNetworking 2.0
我想知道您是否曾经使用过 AFIncrementalStore 在 Core Data 和 REST API 之间进行同步?如果是这样,那么在没有 Heroku Core Data Buildpack
几天来我一直在为此苦苦思索,终究无法弄清楚到底发生了什么。我不太熟悉 Core Data,但我对它的了解足以避免出现死锁情况。然而,对于这个项目,我决定尝试合并 AFIncrementalStore。
我正在尝试为与 App.Net 通信的 Mac 应用程序采用 AFIncrementalStore。与框架附带的示例应用程序不同,我使用带有 websocket 连接的流 API。为此我使用了 Soc
我刚刚开始使用很棒的 AFIncrementalStore并成功运行了一个基本的 iOS 应用程序,该应用程序显示来自服务器的数据(JSON 格式)显示在 UITableView 中。 但是我怎样才能
我正在为 App.net 开发一个 iOS 客户端,我想使用 AFIncrementalStore将 Web 服务与我在应用程序中的核心数据实现同步。 我已经让这两个用于不需要身份验证 token 的
我是一名优秀的程序员,十分优秀!