1

I have an issue while saving UIImage to photo library in device for ios 6.I am able to save the image in simulator but not in device.I have changed the privacy settings for photos in device.Still I am not able to save the image. Below is the code which I am using to save image

UIImage *snap = [sharedSingleton getCopyOfMorphedImage];

    NSData* imageData =  UIImagePNGRepresentation(snap);

    UIImage* pngImage = [UIImage imageWithData:imageData];

   UIImageWriteToSavedPhotosAlbum(pngImage, self, @selector(image:didFinishSavingWithError:contextInfo:), nil);


- (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo
{
    if (error != nil) {
        NSLog(@"Couldn't save image");
    } else {
        NSLog(@"Saved image");
    }
}

I am getting a black image saved in photo gallery with the above code

Can any one help me out?

Satish
  • 133
  • 11

1 Answers1

1

Please try to Log the error message. It will solve your issue

- (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo
{
    if (error != nil) {

        NSLog(@"%@",[error localizedDescription]);        

    } else {

        NSLog(@"Saved image");
    }
}
Shamsudheen TK
  • 30,739
  • 9
  • 69
  • 102