我已在使用此代码保存的binarydata类型属性的nscoredatabase中保存了NSARRAY
AppDelegate *AppDelegate = [[UIApplication sharedApplication] delegate];
NSManagedObjectContext *context =
[AppDelegate managedObjectContext];
//guardar array
NSData *arrayData = [NSKeyedArchiver archivedDataWithRootObject:roll];
NSManagedObject *newContact;
newContact = [NSEntityDescription
insertNewObjectForEntityForName:@"Horarios"
inManagedObjectContext:context];
[newContact setValue:arrayData forKey:@"valor"];
NSError *error;
[context save:&error];
但我不知道如何从数据存储中取回它再次使用此NSARRAY
有人可以帮助我吗?
答案 0 :(得分:0)
试试这段代码:
NSFetchRequest *fetchRequest = [NSFetchRequest fetchRequestWithEntityName:@"Horarios"];
NSError *error;
NSArray *matches = [managedObjectContext executeFetchRequest:fetchRequest error:&error];
答案 1 :(得分:0)
解决了添加此行的问题
[fetchRequest setReturnsObjectsAsFaults:NO];