我的获取请求如下:
if (_fetchedResultsController!=nil) {
return _fetchedResultsController;
}
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription entityForName:@"PortfolioAssetNews" inManagedObjectContext:[NSManagedObjectContext defaultContext]];
[fetchRequest setEntity:entity];
[fetchRequest setFetchBatchSize:30];
NSArray *sortDescriptors = nil;
NSSortDescriptor *byCreatedDate = [[NSSortDescriptor alloc] initWithKey:@"timestampCreated" ascending:NO];
sortDescriptors = [[NSArray alloc] initWithObjects: byCreatedDate, nil];
[fetchRequest setSortDescriptors:sortDescriptors];
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"toAssetDetail = %@", [self.theAssetnews toAssetDetail]];
[fetchRequest setPredicate:predicate];
_fetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest managedObjectContext:[NSManagedObjectContext defaultContext] sectionNameKeyPath:@"pubDate" cacheName:@"PortfolioNews"];
return _fetchedResultsController;
下面的- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
id <NSFetchedResultsSectionInfo> sectionInfo = [[self.fetchedResultsController sections] objectAtIndex:section];
NSLog(@"sectioninfo name==%@",[sectionInfo name]);
return [sectionInfo name];
}
我已经尝试过dateformatter,但它显示为null。 有谁知道发生了什么?
答案 0 :(得分:1)
模拟器始终处于美国语言环境中,听起来就像您的iPad不同。