1

I was using UIGetScreenImage in my app, however, as everyone knows Apple is rejecting apps using private APIs. I have researched alternate ways to do this with takepicture but you get different size images as well as the annoying snapshot sound. Microsoft tag. Quickmark and Redalaser all use the UIGetScreenImage (it's obvious) but I want to do this legally. Does anyone out there have any suggestions. Much appreciated.

jrtc27
  • 8,496
  • 3
  • 36
  • 68
user225061
  • 11
  • 1
  • 2
  • 1
    It might not be the best user experience, depending on your app, but is it possible that you could ask the user to take a screen shot and then get it from the camera roll? – bpapa Dec 04 '09 at 21:14

3 Answers3

3

This might work... I think that it was the answer to another SO question.

-(UIImage *)captureView:(UIView *)view {
    CGRect screenRect = [[UIScreen mainScreen] bounds];    
    UIGraphicsBeginImageContext(screenRect.size);
    CGContextRef ctx = UIGraphicsGetCurrentContext(); 
    [[UIColor blackColor] set]; 
    CGContextFillRect(ctx, screenRect);
    [view.layer renderInContext:ctx];
    UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return newImage; 
}
Brad Larson
  • 170,088
  • 45
  • 397
  • 571
jessecurry
  • 22,068
  • 8
  • 52
  • 44
3

UIGetScreenImage is currently Apple's recommended way of capturing the screen. It's sort of a private method, but they've stated in the developer forums that using it is acceptable until they add a public-API equivalent.

Update: UIGetScreenImage is no longer allowed, as of iOS 4; I believe the approved way to take pictures is now using the AVFoundation framework.

Noah Witherspoon
  • 57,021
  • 16
  • 130
  • 131
0

The best (and the slowest) thing to do is to file a feature request at Apple.

Jake
  • 3,973
  • 24
  • 36