coredate data not show at tableView

Posted by pengwang on Stack Overflow See other posts from Stack Overflow or by pengwang
Published on 2012-11-03T04:58:17Z Indexed on 2012/11/03 4:59 UTC
Read the original article Hit count: 185

Filed under:
|

hello,i used coredate at the tableView,when i enter the viewControl i will call:

dispatch_queue_t downloadQueue = dispatch_queue_create("socket login", NULL);
        dispatch_async(downloadQueue, ^{

             NSManagedObjectContext *managedObjectContext =[self getManagedObjectContext];
            noticListArr=[[CoreDataManager sharedInstance] readEvent:@"NotificationEntity" SortDescriptor:nil managedObjectContext:managedObjectContext];
            NSLog(@"refreshData.count:%d ",noticListArr.count);
            for(int i=0;i<noticListArr.count;i++){
                 NotificationEntity *notificationEntity=[noticListArr objectAtIndex:i];
                  NSLog(@"notificationEntity.name:%@ ",notificationEntity.name);
                  NSLog(@"notificationEntity.describeString:%@ ",notificationEntity.describeString);
                  NSLog(@"notificationEntity.source:%@", notificationEntity.source);
            }


        });


        dispatch_async(dispatch_get_main_queue(), ^{
            [self.tableView1 reloadData];

        });
        dispatch_release(downloadQueue);

all log have value but when i used

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {


static NSString *CellIdentifier = @"NotificationViewCell";


 NotificationViewCell *cell = (NotificationViewCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];

 NotificationEntity *notificationEntity=(NotificationEntity *)[noticListArr objectAtIndex:indexPath.row];

 NSLog(@"tableViewnoticListArr.count:%d ",noticListArr.count);
 NSLog(@"indexPath.row:%d ",indexPath.row);

 NSLog(@"notificationTable.avatarsmall:%@", notificationEntity.avatarsmall);
 NSLog(@"notificationTable.source:%@", notificationEntity.source);
 NSLog(@"notificationTable.name:%@", notificationEntity.name);
 NSLog(@"notificationTable.describeString:%@ ",notificationEntity.describeString);

}

only

 NSLog(@"tableViewnoticListArr.count:%d ",noticListArr.count);
 NSLog(@"indexPath.row:%d ",indexPath.row);

can give me correct result.but all notificationEntity.name notificationEntity.describeString is null.i donot know why at the tabelview cell all value of notificationEntity is null.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about ios