次のエラーが発生しまし[context save:&error]
た。どのように修正すればよいですか?
認識されないセレクターがクラスに送信されました * -[NSKeyedArchiver dealloc]: 警告: -finishEncoding が呼び出されずに NSKeyedArchiver が割り当て解除されました。*キャッチされない例外 'NSInvalidArgumentException' が原因でアプリを終了します。理由: '+[TempObject encodeWithCoder:]: 認識されないセレクターがクラスに送信されました'
ここで私が使用しているコード。
NSManagedObjectContext *context = [self.fetchedResultsController managedObjectContext];
PostRequest *postRequestObject = (PostRequest *)[NSEntityDescription insertNewObjectForEntityForName:@"PostRequest" inManagedObjectContext:context];
DummyClass *request = OtherClassObject;
postRequestObject.request = request;
// request is attribute with type transformable
NSLog(@"requestpost data -> %@",postRequestObject.request);
NSError *error = nil;
if (![context save:&error]) {
// Replace this implementation with code to handle the error appropriately.
NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
abort();
}
#pragma mark - private method
- (NSFetchedResultsController *)fetchedResultsController
{
if (_fetchedResultsController != nil)
{
return _fetchedResultsController;
}
NSFetchRequest *fetchRequest = [[[NSFetchRequest alloc] init] autorelease];
// Edit the entity name as appropriate.
NSEntityDescription *entity = [NSEntityDescription entityForName:@"PostRequest" inManagedObjectContext:self.managedObjectContext];
[fetchRequest setEntity:entity];
[fetchRequest setFetchBatchSize:80];
// Edit the sort key as appropriate.
NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"status" ascending:NO];
NSArray *sortDescriptors = @[sortDescriptor];
[sortDescriptor autorelease];
[fetchRequest setSortDescriptors:sortDescriptors];
NSFetchedResultsController *aFetchedResultsController = [[[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest managedObjectContext:self.managedObjectContext sectionNameKeyPath:nil cacheName:@"root"] autorelease];
aFetchedResultsController.delegate = self;
self.fetchedResultsController = aFetchedResultsController;
NSError *error = nil;
if (![self.fetchedResultsController performFetch:&error]) {
NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
abort();
}
return _fetchedResultsController;
}