开发者

Do you have to use objectWithID when the instance variable is already retrieved?

Below in asyncReloadAndMoveToEnd, we reference conversation which is an instance variable.

In order to access the conversation.messages, do we need to be retrieving that object via the objectID via a separate managed context.

- (void) reloadTable {
    [self.tbl reloadData];
}

- (void) asyncReloadAndMoveToEnd {

    // is this the right way since it's in a separate thread?
    NSArray* messages = [conversation.message allObjects];

    [self performSelectorOnMainThread:@selector(reloadTable) withObject:nil waitUntilDone:NO];
}

- (void) reload:(bo开发者_Python百科ol) inMoveToEnd {

    NSInvocationOperation *operation = [[NSInvocationOperation alloc] initWithTarget:self
                                                                            selector:@selector(asyncReloadAndMoveToEnd)
                                                                              object:nil];

    [queue addOperation:operation];
}


If you are trying to fetch ManagedObjects for display in a UITableView, NSFetchedResultsController is strongly recommended. It handles storage, caching, and all of the general heavy lifting.Ray Wenderlich has a great tutorial on its use.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜