开发者

How do I trigger a reload in an NSFetchedResultsController without changing the fetched object?

In my iPhone app, I have an NSFetchedResultsController showing User objects in a UITableView. The User Objects have 0-many Log objects. A summary of the Log objects are shown together with their User object in the UITableView.

My app uses a tab bar, so user input in the logging tab require that the user tab's NSFetchedResultsController is triggered to reload.

So far I do it by writing to the User object:

log.user = nil;
log.user = [User current]; // Same as before. Just triggering a reload.
NSError *error = nil;
[myManagedObjectContext save:&error];

This works fine, but seems a bit like a hack.

Is there a better way to do this? Like specifying that cha开发者_JAVA技巧nges in the Log object should propagate to the User object too?


[myFetchedResultsController performFetch:&error];

But why would you want to do this? It should only reload when there is new data for it to fetch. If there is new data then a save of the NSManagedObjectContext is the right action.

What is your underlying goal?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜