Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding iOS 7 version of iPhone 4-inch launch image to project breaks launch image when run on iOS 7

Tags:

ios7

xcode5

I'm running into a problem on our landscape only app that targets iOS 6 and 7. Xcode gives me the following warning:

An iPhone Retina (4-inch) launch image for iOS 7.0 and later is required.

If I add the required images, when I launch the app on iOS 7, I get a black launch image shown. On iOS 6, it displays correctly. But without the images, it works just fine on both iOS 6 and 7.

I am already using Asset Catalogs in this project, so I don't think that's an issue.

I would really like to get rid of this warning, but I haven't been able to figure out a way around it.

like image 498
Dennis Munsie Avatar asked Nov 01 '13 18:11

Dennis Munsie


3 Answers

XCode is looking for Portrait orientation for iPhone. You need to provide it for the launch image, but don’t let your application to rotate when device is in Portrait mode.
In order to do this you need to do the following:

  • Go to General -> Deployment Info -> Device Orientation. Deselect Landscape Left and Landscape Right. Select Portrait, then Landscape Left and Landscape Right, order is important!
  • Add the following function to your code (if not yet):

-(NSUInteger)supportedInterfaceOrientations { return (1 << UIInterfaceOrientationLandscapeLeft) | (1 << UIInterfaceOrientationLandscapeRight); }

That’s all!

like image 95
deko Avatar answered Jan 04 '23 15:01

deko


In my case (landscape only app), I was able to fix it by doing the following:

  • adding portrait to the supported orientations for the iPhone in my Info.plist

  • replacing shouldAutorotate: methods with supportedInterfaceOrientations and preferredInterfaceOrientationForPresentation in my view controllers.

  • added application:supportedInterfaceOrientationsForWindow: to my app delegate.

Also I had to make sure that in the Info.plist that the portrait orientation was listed first. Xcode had added it to the end of the list, but if it was there, it would still be a black display on launch. Moved to the top, it was properly detected by iOS when the app was launching.

like image 45
Dennis Munsie Avatar answered Jan 04 '23 17:01

Dennis Munsie


LaunchImage import a 640*1136 picture,

BTW, LaunchImage in Images.xcassets

sample picture

like image 32
jk2K Avatar answered Jan 04 '23 17:01

jk2K