Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Contacts length]:
I'm fetching image from coredata and obvious the format of image is BYTE, so I'm converting it into image. I'm using the following code:
NSFetchRequest * request = [[NSFetchRequest alloc] init];
[request setEntity:[NSEntityDescription entityForName:@"Contacts"
inManagedObjectContext:context]];
NSError * error = nil;
NSArray * objects = [context executeFetchRequest:request error:&error];
NSData *data1= objects[0];
UIImage *image2 = [[UIImage alloc]initWithData:data1];
What to do?
you can use the following