Reputation: 2332
I get the following error when I call [self.fetchedResultsController performFetch].
* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* -[NSFileManager fileSystemRepresentationWithPath:]: conversion failed for /Users/ivanevf/Library/Application Support/iPhone Simulator/5.1/Applications/0EF75071-5C99-4181-8D4D-4437351EC1F4/Library/Caches/.CoreDataCaches/SectionInfoCaches/0
It's the first call I make on the controller after initializing it. The initialization looks like this:
- (NSFetchedResultsController *)fetchedResultsController
{
if (_fetchedResultsController != nil) {
return _fetchedResultsController;
}
// Create and configure a fetch request with the Book entity.
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription entityForName:@"Conversation" inManagedObjectContext:self.objectContext];
[fetchRequest setEntity:entity];
// Create the sort descriptors array.
NSSortDescriptor *msgAgeDescriptor = [[NSSortDescriptor alloc] initWithKey:@"message" ascending:NO comparator:^NSComparisonResult(id obj1, id obj2) {
// some code
}];
NSArray *sortDescriptors = [[NSArray alloc] initWithObjects:msgAgeDescriptor, nil];
[fetchRequest setPredicate:[self fetchPredicate]];
[fetchRequest setSortDescriptors:sortDescriptors];
NSString *cacheName = [NSString stringWithFormat:@"%d%Conversation%d", self.viewType, self.location.bid];
// Create and initialize the fetch results controller.
_fetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest managedObjectContext:self.objectContext sectionNameKeyPath:nil cacheName:cacheName];
_fetchedResultsController.delegate = self;
return _fetchedResultsController;
}
Any idea what's happening here? Thanks!
p.s. a couple of random things i tried: 1. removing the app directory from the emulator. (/Users/ivanevf/Library/Application Support/iPhone Simulator/5.1/Applications/0EF75071-5C99-4181-8D4D-4437351EC1F4) 2. commenting out the setPredicate, setSortDescriptors lines method calls
Upvotes: 1
Views: 992
Reputation: 191
I try this, NSString *cacheName = [NSString stringWithFormat:@"%d%Conversation%d", 1, 2]; and it throw out: 1onversation9283099
It is a regular string ,nothing strange.
Upvotes: 0
Reputation: 186
Looks like you have an extra escape character in cacheName
. Try:
NSString *cacheName = [NSString stringWithFormat:@"%dConversation%d",
self.viewType,
self.location.bid];
Upvotes: 1