How to add these three files properly?"Default.png, Default-568h#2x.png, Default#2x.png" for universal app for iPhone/iPad? - iphone

I added "Default.png, Default-568h#2x.png, Default#2x.png" these three files in my universal project for splash image, I have three diffrent image and the resolution exactly the same as mention in apple docs, for iPad 768 * 1024 , for iphone-4s -> 320 * 480 , for iphone 5-> 640 * 1136.
But my problem is that when I rum on iphone4s- iphone5 the splash rum properly, but when I run on Ipad the Deafault.png splash not showing instead of it takes reference from Default-568h#2x.png. The Default-568h#2x.png is showing on the iPad instead of Deafault.png and the image got blur and shrink on ipad also, beacuse Deafault.png not showing. How to slove this problem.
Any Idea or suggestion from experts would be highly welcome.

Launch image naming should be similar like this for universal application.
iPhone > Default~iPhone.png,Default#2x~iPhone.png & Default-568h#2x.png.
iPad > Default-Portrait~iPad.png,Default-Portrait#2x~iPad.png,Default-Landscape~iPad.png,Default-Landscape#2x~iPad.png
Please refere the following link for more details regarding image resolutions
http://developer.apple.com/library/ios/#documentation/userexperience/conceptual/mobilehig/IconsImages/IconsImages.html
and for image naming conventions use the following link
http://developer.apple.com/library/ios/#documentation/iphone/conceptual/iphoneosprogrammingguide/App-RelatedResources/App-RelatedResources.html

First I would like to suggest that,
Preapre all Images,
Select Project from Project Navigator And Go to Summary and scroll down this
screen appears, then right click on that and choose file from your
computer it will automatically copied to project and it will entered
in plist file also..
if your application is universal then you have
to set for iPhone and iPad Both.
`

See the offical document at chapter App Launch (Default) Images:
App Launch (Default) Images
Only you should do is set the launch image a proper name with relative size, then add those images to the project. Xcode will help you to display it correctly when app launching.

Related

How To set Launch Images for Universal app

I'm using Xcode 10.1 and my app is a universal app. I'm having a design issue when loading the launch images using the assets i.e. it showing some black screen background in iPad Pro 11 inch and iPad pro 12.9 (3rd generation) devices other than that it working fine in all devices. So how can solve that issue? And If I want to use the LaunchScreen.storyboard file how can I set a single image to satisfy all screen sizes(which image size and what resolution(2x or 3x) have to use) ? or how to use the Static Launch Screen Images by the apple click here?
Any help appreciated.
As you wrote there are two ways to configure the LaunchScreen:
Static image from the special imagest - LaunchImage.launchimage
Designed screen that can hold multiple UI elements - LaunchScreen.storyboard
If your launch screen is simple enough and you choose to use Static image please make sure that your Info.plist doesn't hold the following key: <key>UILaunchStoryboardName</key> <string>LaunchScreen</string>, if it does then the static image won't be used.
The LaunchImage.launchimage holds an image for all device types and tells you which image size to use.
If you use it and do populate all the images and still some devices has no launch image try cleaning and rebuilding your app and uninstalling and reinstalling the app from your test device or simulator. Also consider updating your environment (xCode).
If you choose to use Designed screen please avoid setting the source of your ImageView to the LaunchImage.launchimage, its a special imageset. You can only use regular x.imagesets with less images (1x 2x R4 3x).
Take a look at the following answer to a different question, it explains the mechanism that auto selects the image, it also has table that connects iPhone type to the selected image.

App launches in full screen in simulator, but not on device

This is an Xcode 6 Swift project. When choosing iPhone 5 or 5s in the simulator, the app launches at full screen height. However, when running the app on an actual device (an iPhone 5s), the screen is only iPhone 4 in height (i.e. black bars appear at the top and bottom of the screen).
The strange thing is that I've re-created this project from another test project - and in the original project I didn't have this problem.
I've performed a text-compare on the storyboard xml files for each, and both are mostly identical. I've also looked at the Build Settings for each, and can't see any obvious differences. Finally, the json files specified in the "Images.xcassets" directory for each are the same.
Managed to fix the problem. In the General settings for the target, under "App Icons and Launch Images" I clicked the "Use Asset Catalog" button and followed the options.
Place the Launch screen images for both iphone 5 and iphone 4 . Put the size of the default-568#2x image as 640 x 1136 .
May be you missed this size of splash screen in your project.
For me it was fixed after adding the images with all sizes
For me, this was because I'd saved the file in photoshop format, but with a PNG extension. The emulator loaded the file, but the actual device couldn't. Wasted 3 hours messing with asset catalogs before I figured it out!
Blog post on subject

Black screen instead of launch image on iPad

I am developing an iPhone app for iOS 6.1 and 7 (using Xcode 5). I have a problem with iPad launch images.
On iPad 7.0 and 7.0.2, the launch image is not showing up(in 6.1 works!): I get black screen while app is loading.
I don't face this issue with iPhone 6.1 and 7.0.2, although I set all launch images required for iPad and iPad retina (landscape and portrait) and I use Asset Catalog.
What am I missing?
Recently I faced same issue with my App designed only for iPhone , I had the problem where the launch images would not appear in iPad (On iPad ios >= 7.0.x the launch image is not showing up I get black screen while app is loading (in iPad ios < 7.0.x it works fine )).
I don't face this issue of launch image with iPhone worked fine in all iOS versions.
Solution: Is to update to asset catalog to manage your app's images and target only iOS 6 and Prior.
Steps :
Step 1:
Step 2:
Step 3: on the top right corner click on the 'Attribute Inspector' icon. Here you can set the Target OS for the Launch Images.
Uncheck the iOS 7 check boxes for iPhone, Now you should be able to see the launch images for iPad on iOS >= 7.0.x.
If you have the same situation like mine, that's solution:
My app is landscape only, iOs7 only, ipad\iphone (XCode 5).
Problem: black launch on iphone (and simulator), normal launch in ipad.
Solution: go to Images.xcassets - Launch Images - select it. Uncheck at right all "iOs7 and later" boxes. Check "iOs6 and prior" boxes and fill empty spaces with images.
Strange, but works.
Per Apple's documentation (link); an empty iPad specific storyboard may be the answer. I've also seen issues where the initial view controller is not set within a storyboard causes a black screen. A variant of this issue might be an incorrect setting in the app plist.
Technical Q&A QA1780
Why does my app launch to a black screen on iPad?
Q: Why does my app launch to a black screen on iPad?
A: Apps that have been designed only for iPhone may launch to a blank screen when run on an iPad. This is caused by the presence of an empty iPad specific storyboard in the app bundle as well as an iPad specific UIMainStoryboardFile key in the app's Information Property List (Info.plist) file. Both are automatically created by the various Xcode template projects if the Universal option is selected.
...
In Xcode
Look for a file named MainStoryboard_iPad.storyboard in the file navigator. If this file is present, remove it from your project.
In your app's Information Property List
Look for a key named Main storyboard file base name (iPad) or UIMainStoryboardFile~ipad. If this key is present, remove it. You should also remove any other key suffixed with (iPad) or ~ipad.
Finally, test your app on an iPad or in the iPad simulator and verify that it behaves as expected.
I requested Apple support and it turned out that it's a bug. They asked me to report it and I did. Here is the report id : 15340531.
Now it's up to them.
Using LaunchScreen.storyboard
I was having a similar problem until I found the following settings in the General Project Settings.
Set your Main Interface to your main storyboard file. Mine is called Main.storyboard.
Set your Launch Screen File to your launch screen storyboard file. Mine is called LaunchScreen.storyboard. (This is what I had originally ommited.)
After that the launch screen loaded first and then the main story board loaded shortly later.
Try set the image again make sure that resolution of the splash screen is according to the iOS 7 guidelines
I know this sounds stupid. I've had bugs like that when I saved a file in psd-format with a jpg extension. Just 1 wrong click while saving your launch image.
After having tried several solutions found here, I suspected that the iPhone was trying to launch in Landscape orientation, and thus not finding any corresponding launch image. Indeed, the simulator was starting in Landscape for a reason I was not understanding.
Finally, after reading Apple documentation, I found that it's probably the order of keys in "Supported interface orientations" of the info.plist file that was not adequate. The Portrait was the last item. When it's the first item, the app launch in Portrait mode and find the image.
Remove previously installed app from the device or simulator, Then relaunch the app after clean.
I had the problem where the launch images would no appear in iPhone (3.5 or 4 inch) in iOS 7, but the iPad had no problems with iOS 7.
Long story short is I disabled the asset catalog for the launch images only. So I'm adding the launch images the old fashioned way. That seems to have solved the problem.
I will have to do more testing tomorrow, but it seems the problem is solved (at least in my case).
in Xcode 5 , make sure thay you add all needed images mentioned in your app target.
I am assuming that when you are using Asset Catalog, you have ensured that you have the Images.xcassets target membership added correctly. I am mentioning this since if you have multiple targets, looks like you have to add them manually (and you have not provided any screenshots so one can be sure).
Now that you have not really provided a screenshot of the "LaunchImage" overview of Images.xcassets folder in your project, I can only guess the probable reason. Looking at the fact that the launch images work fine for iPhone (6.1 & 7.0.2 and iPad (6.1) and do not work only for iPad (7.0 and upwards), I think you could perhaps look at as to whether the dimension of the images for iPad Portrait and iPad Landscape are proper for iOS7. Specifically, you should see your launch images and not empty rectangles as seen in the attached pic-
This can happen due to the fact that you still have the iPad launch images for iOS7 created excluding the status bar area. Prior to iOS7, the iPad launch images were created to exclude the status bar area, but it's a must on iOS7 that all the launch images must include the status bar area. Please go through the section "Things Every App Must Do" in Apple iOS7 UI transition Guide (https://developer.apple.com/library/ios/documentation/userexperience/conceptual/TransitionGuide/TransitionGuide.pdf).
The following screenshot should explain what I am talking about-
e.g. you can see that iPad Landscape Retina image dimension for iOS6.1 and previous is 2048x1496 (excluding 40 px for status bar) but the dimension for the same image for iOS7.0 and upwards is expected to be 2048x1536 (including the 40px for status bar). So, if you have not changed your images accordingly, you will see black screen for images on iPad 7.0 and upwards. On iPhones, you will not face this issue since iPhone launch images always cover the status bar, be it iOS6.0 and iOS7.0- so the new UI requirement is already met for iPhone launch images.
I found this answer which worked for our app (iPhone only, but used on iPad): https://stackoverflow.com/a/19448782/1258419
To summarize from that answer:
How to do it. Go to the asset catalog. And on the top right corner click on the 'Attribute Inspector' icon. Here you can set the Target OS for the Launch Images. Uncheck the iOS 7 check boxes for iPhone. Now you should be able to see the launch images for these devices.
I encountered a similar problem in landscape, my iOS 7 launch image wasn’t displayed while the iOS 6 did. Mine was the iPhone Retina 3.5” launch image.
Since I have another app in portrait that didn’t share this issue, I did 2 things:
In info.plist, under “Supported interface orientations”, I added the
2 portrait modes as well, and put them before the landscape, like
this:
Item 0: Portrait (top home button)
Item 1: Portrait (bottom home button)
Item 2: Landscape (right home button)
Item 3: Landscape (left home button)
Implemented this method in the View Controller:
-(NSUInteger)supportedInterfaceOrientations{
return UIInterfaceOrientationMaskLandscape;
}
This works with or without the Asset Catalog.
This is an update for iOS 8.
I got the same problem when I tried to add a LaunchImage to my iOS 8 app.
Apple enables developers to use a xib, whose default name is LaunchScreen.xib, to render the launch view as of iOS 8. I believe developers can use either LaunchImage or LaunchScreen.xib. Unfortunately, I couldn't find any document describing how to deal with LaunchImage after LaunchScreen.xib was introduced. I always got a black screen when I tried to use LaunchImage as the launch view.
My solution is:
Don't think about LaunchImage. Use LaunchScreen.xib. (You have to keep an empty LaunchImage in your Asset Catalog though. I believe it's a bug.)
Drag an UIImageView to the xib and make the UIImageView full screen. Remember to take the size classes and constraints into account.
Set an image whose resolution is enough for iPhone 6 plus to the UIImageView.
Check your all images and see if it is properly placed in the Asset and properly named and sized.
Also check which orientations your are allowing and accordingly add images to the asset.
I had the same problem.
I had to make a workaround: used the Default image for all iOS versions and DELETED the UILaunchImageFile key from info.plist.
I cannot use different launch images for iOS 7 and previous versions, so, I had to use the same "artistic" image for all, instead an image that mimic the first view of the app (which Apple recommends and I prefer), but at least I do not get the black screen anymore.
It looks like the UILaunchImageFile key that allows to use differents launch images for iOS 7 and previous versions is not working properly for Retina iPad in iOS 7.
WARNING: I am still testing the app, so I don't know if could be some side effects.
I also faced the similar issue but its solution was simple (in my case).
All I did was following -
1.Add a new file (if you have not added it) Launchscreen.storyboard
2.Get a UIViewController, mark it as Is Initial View Controller then add a UIImageView in it and set a picture which you want to display during launch of your app. Make sure you give this UIImageView required constraint.
3.Go to Project->General->App Icons and Launch images and select Launchscreen.storyboard as Launch Screen File (There will be a dropdown for it).
Because of iOS 13 and later, app launch different than earlier versions.
Get the solution from below URL.
https://stackoverflow.com/a/59913274/883505
I simply forgot to call super.loadView() in my view controller...
override func loadView() {
super.loadView()
}

Startscreen in iPad shows 2 splash-screens

I have the problem that starting my app on iPad shows me 2 splash-screens. First one is correct iPad-splash. Second seems to be the splash of iPhone app (replaces the first one after about 500ms).
The devices-option in build settings is set to "universal".
Filenames for the images are:
Default-Landscape~ipad.png
Default-Portrait~ipad.png
Default#2x.png
Default.png
(in that order, not sure if that matters)
has anyone an idea why this happens?
Thx in advance.
max
Simply add a Default~ipad.png file to your project for a iPad specific splash. The Default.png is meant for iPhone. For more info, see also the good blog entry Icons and launch images for iPhone and iPad apps.

Dimensions + Name for Launch Screen and icon for iPhone 4 in XCode

I have the Default.png for iPhone 3GS and older models. I was just wondering what is the name of the launch screen for iPhone 4 and what is the name of the icon for iphone 4. I am pretty sure the launch screen is Default#X.png but i cant remember. I do not have an idea of what the icon could be. ALSO, if I dont incorporate the iphone 4 launch screen or icon will the launch screen and icon show up on the iphone anyways, just more blurry? I do not want to get a reject from apple. Thank you.
Please see apple's documentation . This QA section also is very informative. See this also..
Add a #2x to the name and use 640x960 as resulution for the launch screen.
You can find informations about the Icon dimensions here (German, but the important part is the table with the dimensions)