1
votes

Using XCode 4, how do I take screeenshot of a Universal app which I have created (iPhone/iPad) ?

Is it necessary to connect the device and run the app on that to take screenshot ?

Actually I have IOS SDK 4.3 installed and on the iPad, it is the latest IOS 5.1

So I cannot actually test the app on the iPad. May be I can download the latest SDK, but that would take a lot of time. So it would be great if I could get screensots from within the simulator or something ?

Also it is a Universal app. So I would need both iPhone (i have only iPod touch device IOS 4.2.1) and iPad screenshots ?

4
Before you submit the application to the store, please do make sure that you download the appropriate SDK (in a separate directory from the stable Xcode release) so that you can test on your real iPad hardware. Never ship something without testing it on an actual device. Also, some subtle things changed from 4.x to 5.x, so any issues there might be revealed if you run this on your iOS 5.1 iPad.Brad Larson

4 Answers

2
votes

When the iOS-Simulator is open, you can press CMD-S to save an image of the screen to your Desktop.

1
votes

I don't have the 4.3 SDK installed but you should be able to take screenshots from the iOS Simulator with the Edit Menu.

If the "copy screen" item does not exist (could be they added that in a later version) you should try to press the control (and if that doesn't work the option key) while the edit menu is expanded.
In the older versions of the iOS Simulator the "copy screen" menu item should appear.

And then just paste the screenshot to Preview or your favorite image editor.


Btw. you can test the App on the iPad when you create an Ad-Hoc build and install it.

0
votes

If I understand the question correctly just use the mac shortcuts to take a screen shot of the simulator? command + shift + 4

0
votes

If you want to make screenshot programmatically into your app then write this code

    if ([[UIScreen mainScreen] respondsToSelector:@selector(scale:)])
        UIGraphicsBeginImageContextWithOptions(self.window.bounds.size, NO, [UIScreen mainScreen].scale);
    else
        UIGraphicsBeginImageContext(self.window.bounds.size);
    [self.window.layer renderInContext:UIGraphicsGetCurrentContext()];
    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    NSData * data = UIImagePNGRepresentation(image);
    [data writeToFile:@"screenshot.png" atomically:YES];

It will work for both iPhone and iPad devices.

If you want to make a normal screenshot of iOS Simulator, then run your app and use hotkeys - Cmd+Shift+4 -> Space -> Select window.