I am saving image in nsuserdefaulf in my first viewcontroller where i am getting image from imagepicker
[[NSUserDefaults standardUserDefaults] setObject:UIImagePNGRepresentation(image) forKey:@"image"];
and i am getting this image in next viewController like this
NSData* imageData = [[NSUserDefaults standardUserDefaults] objectForKey:@"image"];
UIImage* image = [UIImage imageWithData:imageData];
but when i am passing this image for use it giving me error but when i am using image like this than it works. ( bg.png is saved inside project)
UIImage *image = [UIImage imageNamed:@"bg.png"];
Whats the problem with my code. ?