Wednesday, August 08, 2012

Prepare your apps for the iPhone 5

Earlier today, my friend Peter Steinberger asked:

Does anyone know what does “special iPhone Simulator tweaks” are? I’d love to test my stuff with different resolutions. http://9to5mac.com/2012/08/07/upcoming-ios-6-is-scalable-to-taller-640-x-1136-iphone-display-shows-possible-next-generation-device-user-interface/

So I investigated, and found a pretty elegant solution. Without further ado, here is how to change the size of the iOS simulator in order to test your apps in resolutions never seen before.

  1. Download File.txt into ~/Library/Application Support/iPhone Simulator (don't change the name of File.txt)
  2. Edit /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone Simulator.app/Contents/Resources/Devices/iPhone (Retina).deviceinfo/Info.plist and add the following keys:
    <key>eagle</key>
    <string>640</string>
    <key>giraffe</key>
    <string>1136</string>
  3. Add setenv("CLASSIC", "0", 1); just before UIApplicationMain in your main.m file in order to support any simulator version.
  4. Quit the iOS Simulator app

You are now ready to test your apps on the rumored 640×1136 new iPhone.

This hack works on Xcode 4.4.1+ and the iPhone 5.1+ Simulator with the iPhone (Retina) device.

22 comments:

Anonymous said...

Inspired by 9to5Mac's post from this morning: http://9to5mac.com/2012/08/07/upcoming-ios-6-is-scalable-to-taller-640-x-1136-iphone-display-shows-possible-next-generation-device-user-interface/

Anonymous said...

What happens if you alter the width more or the height more? I am curious because if its fixed to 1136 height resolution, its evidence that they're introducing a taller screen. If not, then we still can't be sure about the screen.

Anonymous said...

Really impressed you found this. Perhaps you had "hints"? ;D

Anonymous said...

Does not seem to work. I had trouble editing the Info.plist so I first changed it to xml then changed it back. If never changes the size of the Sim.

Егор Меркушев said...

It works with iOS Simulator 5.1 (272.21)!
Thanks!

Anonymous said...

This works. Fantastic! Tested with the latest official XCode release (not beta) and iOS 5.1. As it was read-only, I copied the (binary) info.plist file to the desktop before editing with xcode.

Frank Schmitt said...

This works great, but I've found that apps other than SpringBoard don't see the taller screen.

Also, I believe it's possible to copy the whole iPhone (Retina) directory, renaming it something like iPhone (Retina Tall) and editing the name in the plist. You could go so far as to edit the chrome graphics as well, but since all you get at this point is a taller SpringBoard, the utility is limited.

Anonymous said...

Frank, don't use iOS 6.0 in the simulator. Run either 5.0 or 5.1.

As for iOS 6.0, it seems weird how the simulator is the only thing that runs in the tall mode. Perhaps there's a plist key we can add to our apps to tell the simulator to allow stretching in iOS 6.0?

Unknown said...

Thanks for this!
A couple notes:
On Xcode 4.4.1 it seems you need to Scale the Simulator Window to 75% or 50% to keep the top and bottom portion of the new screen real estate from truncating. Probably something with hiding the bezel.
Also the link to File.txt can't be saved directly.. The tiny URL service wraps the text file with HTML. It requires cut and paste of the XML once you open the link.

trojanvillage said...
This comment has been removed by the author.
Esteban Orrego said...

who helps me?. make all the changes but the screen remains in the same way. thanks

PaulF said...

"Perhaps there's a plist key we can add to our apps to tell the simulator to allow stretching in iOS 6.0?" Probably, because you wouldn't want this for all apps, only for apps that have been tested with the new size.

Ephraim said...
This comment has been removed by the author.
Anonymous said...

Well, I do get the updated screen resolution but the simulator is somewhat messed up. For one thing the status bar is missing and other things (like the notification center) aren't displayed correctly. So I am not sure if this hack is good for anything?

Anonymous said...

How do you do this on the non-retina simulator?

Sebastian Misiewicz said...

brilliant! thx

Santanu Koley said...

Hi I am using Xcode 4.5 beta version and iPhone 6.0 simulator. I have done as per instruction but not reflecting in simulator. Is there any mistake?
Please help.

In main.m I have added like:

int main(int argc, char *argv[]) {

NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
setenv("CLASSIC", "0", 1);
int retVal = UIApplicationMain(argc, argv, nil, nil);
[pool release];
return retVal;
}

mary brown said...

This works. Fantastic! Tested with the latest official XCode release (not beta) and iOS 5.1. As it was read-only, I copied the (binary) info.plist file to the desktop before editing with xcode. Additional Info

jack hill said...

I am curious because if its fixed to 1136 height resolution, its evidence that they're introducing a taller screen. If not, then we still can't be sure about the screen.unlock iphone 3gs guides

ferhatulu said...

Great!!! That solution work for me, using xcode 4.5.1. Thanks so much buddy.

Sweet Fairy said...

Is it work? I bookmark you and must try it. I will be back after result. Thanks for sharing. en ucuz iphone

safdar said...

This is awesome. Thanks for sharing.