I am taking the screenshot of my last viewed Screen, by the following code
//Image Code
UIImage *nextImage;
CGImageRef imgRef = CGBitmapContextCreateImage(UIGraphicsGetCurrentContext());
nextImage = [UIImage imageWithCGImage:imgRef];
CGImageRelease(imgRef);
CGContextRelease(UIGraphicsGetCurrentContext());
When i displayed the the image in the console i got the O/P like: UIImage: 0x929c760
The Problem lies here for me, When converting that UIImage to NSData i am getting null.
The things i have tried are
//tried
NSData *data = UIImagePNGRepresentation(nextImage);
NSData *data2 = UIImageJPEGRepresentation(nextImage, 1.0);