Gulliva
Gulliva

Reputation: 488

Take Screenshot in iOS 8 with Objective C doesn'work

i have written an App that takes screenshots. If the user enables this feature the app uses a background queue to take screenshots.

In iOS7 everything works fine but with iOS 8 there are only send white Screenshots to the server.

I use this method to take a screenshot:

 CGImageRef cgScreen = UIGetScreenImage();
    if (cgScreen) {
        result = [UIImage imageWithCGImage:cgScreen];
        CGImageRelease(cgScreen);
    }

Does anyone have an idea to solve the problem?

Upvotes: 2

Views: 1710

Answers (1)

Goppinath
Goppinath

Reputation: 10739

Unfortunately I could not find the Apple's official documentation about the method UIGetScreenImage() but I have read so many stackoverflow entries saying that has been removed in iOS8 and especially iOS7 with 64bit binaries.

I am using following method to make screenshot and which is working from iOS 5 to iOS 8 without any problem.

- (void)makeScreenShotWithView:(UIView *)view scale:(float)scale {

    UIGraphicsBeginImageContextWithOptions(view.bounds.size, YES, scale);

    [view.layer renderInContext:UIGraphicsGetCurrentContext()];
    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();

    return image;
}

if you want to make the whole screen as screenshot then pass a window object for an example view.window.

Try this

Upvotes: 2

Related Questions