1

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 ?

copenndthagen
  • 49,230
  • 102
  • 290
  • 442
  • 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 Dec 07 '11 at 16:43

4 Answers4

2

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

fabian789
  • 8,348
  • 4
  • 45
  • 91
1

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.

Matthias Bauch
  • 89,811
  • 20
  • 225
  • 247
0

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

Pranav Bhargava
  • 390
  • 3
  • 9
0

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.

beryllium
  • 29,669
  • 15
  • 106
  • 125
  • Thx a lot...Would the hotkey method give the exact size which we need to submit in the Appstore ? Or do we need to manually update to the required size? – copenndthagen Dec 04 '11 at 09:38
  • With hotkeys you can select area for capturing (without Space button). When you use Space it would be an image whith **full** iOS Simulator (with black borders). In my expirience, pictures for appstore usually were provided by designer.. – beryllium Dec 04 '11 at 09:42
  • 1
    If you're using the iOS 5.x SDK, the iOS Simulator now has a File | Save Screen Shot option which avoids the hassle of cropping out the borders of the simulator window. It does save the files in odd places sometimes, though: http://stackoverflow.com/questions/8286120/where-are-ios-5-simulator-screenshots-stored You can also use Edit | Copy Screen, go to Preview, and choose File | New from Clipboard to grab just the screen area from older versions of the iOS Simulator. – Brad Larson Dec 07 '11 at 17:01