LaunchScreen not loading - swift2

I am using Xcode 7, Swift2, Universal, I tried many different ways to make my LaunchScreen load,have no idea what else can I try, (I set up the app icon, it shows in my iPhone and the simulator as well). I already deleted my launchScreen.storyboard and add a new one as File>New>UserInterface>Launch Screen, tried all steps again and still can not see the launch Screen, can someone take a look in my sequence and let me know what Am I doing wrong?
I have a Launch Screen.storyboard (it in not nib extension)
Deleted both labels on it
Added a ImageView
selected 4 constraints to 0 and updated Frames and the image enlarges to full screen
General TAB>AppIconsandLaunch Images>LaunchImagesSources>Selected Launch Screen. (there are two options: Launch Screen Storyboard and Main Storyboard, when I select LaunchScreen.Storyboard shows after the dropdown list is gone only: LaunchScreen without the extension)
Selected assets.xcassets and add a NewIosLaunchImage
Selected the LaunchImage and there are 9 spaces for Images (I have selected in the attributes Inspector only iOS 7 & 8)
Added all 9 images with the correct sizes in the containers
set a breakpoint in the appDelegate to stop in the launchScreen
Run the app, and the LaunchScreen does not load.
Any help is more than welcome :)

Happened to me, make a New Brand Assets in General > App Icons & Launch Images, leave the Launch Screen File > Blank, App Icon > Launch Images source set the name of the New Brand you made.Go to assets.xcassets highlight the New asset you just created, in the attributes Inspector select the iOS targets, Select Product menu > Clean, and run the app. Let me know if works...

Related

How to convert manual view controller to storyboard as a launch screen

New iOS requirements need Apps for iPhone or iPad must be built with the iOS 13 SDK or later and use an Xcode storyboard to provide the app’s launch screen.
But my project is very old and has never used Storyboards. All UI elements are created dynamically using ViewControllers.
I managed to create a storyboard file and set it as a launcher but it has no scenes and I do not know how to proceed. I would like to:
Create a scene where I place only the original launch image inside (hoping that apple still accepts this branding)
If it is possible to just connect my main ViewController with the scene (if that works with dynamical ViewControllers)
If nothing helps than I would need to create a simple scene which has just a bottom bar like my ViewController
I had this exact issue, here's what I did:
Create LaunchScreen.storyboard and set to use it as launch screen
Using the + button in the top-right (this was not an obvious step), add a View Controller into the storyboard
Untick "Use Safe Area Layout Guides" on the right panel if you're getting that error
Tick "Is Initial View Controller"
Then clean and run, for me it just worked. I did have trouble seeing it update though, as discussed here: Launch Screen storyboard not displaying image

Xcode application, Splash screen doesnt work on low resolution iPad

I'm opening a topic here to find some help regarding the Splash screen on iOS. Apparently, all the process seems to be quite simple, but unfortunately, I've encountered a problem just on a specific case : the default splash screen is showed on the iPads with low resolutions (iPad , iPad 2, iPad Air , ...), the custom one is not set.
Specificity : The application is developed with React Native (Framework) only for iPad on a Landscape mode.
Here below you will find the steps that I followed to achieve the Splash screen :
2 pictures prepared for the Splash screen : Default-Landscape.png (1024*768px) & Default-Landscape#2x.png (2048*1536px).
Project opened on Xcode : MyProject.xcodeproj
Check out the folder "Images.xcassets" in the project.
Left click (2nd column from the left. In the full display interface) > App Icon & Launch Image > New iOS Launch Image.
Two new things appeared: one drop zone and a checklist with the devices that we wanted. Then I've chosen what interested me.
Drag and drop the images in the specific drop zone related to the good format.
After the image uploaded I've click on project "MyProject" (1st column) > click on target "MyProject" (2nd column) > click on "Use catalog assets" (button on the 3rd column) > select "Migrate" > then in the drop down menu I've chosen the settings that I've prepared before "LaunchImage".
Finally I removed the folder "Base.lproj" where the default splash screen (LaunchScreen.xid) was.
Result: After compiling, I've seen that the Splash screen was working for the high resolution devices (iPad Air 2 & iPad Pro), but unfortunatly, on low resolution (iPad 2, iPad Air, iPad Retina), I still have the default screen "NameOfProject" as headline and "Powered by React native" on the bottom of the page.
I really hope that you can help me on this one because I really don't know what's going wrong there. I've tried different import methods, differents sizes and names for the images. But still nothing work.
You may have to delete the app from the Home screen, and then reinstall it. iOS seems to cache the previous launch image for some reason.
Also make sure that your image sizes are correct if you haven't already.
Thanks a lot rclai89!!
Just to add some details to complete this topic. This video explains what you've advised me and solved my problem : https://www.youtube.com/watch?v=yiSehGHZZ18.
App removed from the Home screen : Once the emulator is running, on the top navigation choose Simulator > then Reset Content and settings.
Cache cleared : CMD + SHIFT + K
Derived Data cleared : On Xcode go to the Window item (top navigation) > select Projects > next to the "Derived Data" you have the path where the file is contained, just need to click on Delete button and everything is done.
Close & Re-Open Xcode. The next compilation for all the different devices (in my case iPad) show up the splash screen that I wanted. Awesome!

text height different between IB and simulator

On a test drive app, I have a basic UIViewController (QZTestViewController) loaded with its xib file with only one UILabel centered by autolayout. This controller is opened from the home controller (QZHomeViewController designed in the default storyboard).
The problem is that the height of this label is smaller that the result on the simulator. See it in XIB/Simulator comparison snapshot.
Any idea ? A small test project is available here if someone can have a look and help me before I become crazy.
PS: Note that the simulated metrics is set to iPhone 5.5-inch in the XIB file and I run the simulator iPhone 6s Plus (9.3).
From the size of the status bar items on the Simulator (and double-checking your project), I can tell that your app is being upscaled to fit the screen. This is happening because it's not properly configured to the 4.7" or 5.5" screens.
To fix that and make it load with the correct resolution, simply add a LaunchScreen storyboard to your project. Go to your project settings, select your Target and in App Icons and Launch Images select a storyboard or xib file to Launch Screen File. This will make the app compatible with the larger screens' resolutions, and your button will have the correct size as it will not be upscaled :)

Is there any way to update an old app with Xcode 7 and the iOS9.1 SDK and use the awesome auto scaling for the iPhone 6/6+? [duplicate]

Installed the app on iPhone 6 iOS9 and here is what happened. Notice black bars on top and bottom. It works just fine on iOS8. How I can fix it?
I've tried building with Xcode 6.4 & 7. Same result.
(iPhone 5 used to run iPhone 4 apps like this)
Did you migrate your app from an earlier version of Xcode? If so then Xcode is now making an assumption about your screen size and you need a way of indicating the actual screen size at run time.
There are two ways:
a) If you use a launch screen.
You are missing a LaunchScreen.storyboard file.
Create a Launch Screen object from the New File... dialog
b) If you don't use a launch screen.
Go to your Target's settings and choose General, then App Icons and Launch Images.
Now set "Launch Screen File" to your "main.storyboard" (or another storyboard if appropriate)
My App does not use a launch image.
Setting the "Launch Screen File" to my "main.storyboard" file fixed the issue for me.
This setting can be found under "Target->General->App Icons and Launch Images"
Use the following link for more information:
http://oleb.net/blog/2014/08/replacing-launch-images-with-storyboards/
For me the problem is i'm migrating my app from earlier version of Xcode and the project is missing LaunchScreen.storyboard file. I have just created LaunchScreen.storyboard and added it to launch Screen File. This did the trick.
I'm using xcode 7.2 . At first, I created a LaunchScreen.storyboard file, as Potassium Permanganate
suggested, and it worked! However, I didn't want a launch screen, so I tried setting Main.storyboard as Launch Screen File and it did the trick!
This one is if you do not use storyboard at all.
It occurs when you remove LaunchScreen from Launch Screen File in App icons and Launch Images.
Instead of removing it from here go to info.plist and find Launch screen interface file base name and remove LaunchScreen, i.e. leave it blank.
It wont show in info.plist if you have removed LaunchScreen already from Launch Screen File. Then you can give any name in Launch Screen File and it will appear and you can remove the name.
When you migrate your app from earlier version of xCode to xCode 6 or xCode 7, you will face this issue.
For iOS 7 and earlier, developers need to provide separate launch
images for all screen sizes, resolutions and orientations their app supported.
In Xcode 6 or later, there is another option. You can specify a storyboard whose initial view controller will then be used as the app’s launch screen. Use below steps:
Create a blank storyboard file named LaunchScreen.storyboard.
Go to your target settings and, on the "General" tab, select the storyboard as your Launch Screen File in "App Icons and Launch Images" section. Xcode will add a corresponding UILaunchStoryboardName key to your app’s Info.plist. When this key is present, Xcode will prioritize it over any launch images you might have set.
Add some subviews to newly created storyboard's view and position them with constraints. When you launch the app on a device, the OS should use the scene as the launch screen.
Delete the older app from simulator and clean the project.
Cheers :-)
I have same issue in my app . In my app i have multiple targets added to project . If i use launch storyboard solution then i can see full screen but in my case my Lunch image looks blurred and stretched on iPhone 4 . To come out from this issue I have used LaunchImage asset solutions . After this still I am facing same issue .I have tried all above solutions, At end I found my png images don't include ALPHA resolutions . After adding new images ,i can see full screen images .
iOS changed the way the system detects the resolution of the iPhone. You used to have to supply a number of png images named things like "Default-568#2x.png", "Default-667h#3x.png". Now you don't have to do that anymore. You need to delete those "Default-568#2x.png" style files and move on to using a proper LAUNCH SCREEN object in your project.
To add a launch screen just go to the New File... dialog (File / New / File, or press Cmd + N)
Double click that new Launch Screen file to edit it. Be sure it is ticked "use as launch screen" in its properties.
Finally be sure to select your LaunchScreen.storyboard file under project properties / Targets / "App Icons and Launch Images"
Go to the asset catalog and create a new iOS launch Image. then in Target>General>App Icons and Launch Images>Launch Image Source you will see automatically the new Launch Image created in the assets catalog.
In my case, I have several targets in the project and each one has it's own launch screen images. The weird thing one of the targets looks fine but others have those black bars. The thing was in the name of Launch folder inside assets. Change name to LaunchImage solves the problem.
Swift 4.2
select LaunchScreen.storyboard if its empty
In my case I have one asset with launch images however it was displaying the top and bottom dark bar as well.
I've tried the launch storyboard solution and yes it works but I didn't want to add a new file so, this is what I did to fix the issue:
Copied my launch images to another folder
Removed the existing LaunchImage asset
Added a new LaunchImage asset
Added the images to the new LaunchImage
That's it!
Go to target settings in xcode in that section go to App icons and launch images section in that section select launch screen file you will find a drop down of values select CDVLaunchScreeen value against launch screen file value
I had a similar issue on an iPod. To fix this, I replaced
<key>UILaunchStoryboardName~ipad</key>
<string>LaunchScreenIpad</string>
<key>UILaunchStoryboardName~iphone</key>
<string>LaunchScreenIphone</string>
with
<key>UILaunchStoryboardName~ipad</key>
<string>LaunchScreenIpad</string>
<key>UILaunchStoryboardName~iphone</key>
<string>LaunchScreenIphone</string>
<key>UILaunchStoryboardName~ipod</key>
<string>LaunchScreenIphone</string>
in Info.plist.
I had an old app (iOS 7.4 - 8.2) and after upgrading it got the same issue (getting black empty bar at the top), I managed to solve it by:
Main.storyboard
Choose your Scene & Controller
on left menu, go to Attribute Inspector
find "Presentation" and instead of "Automatic" set it to "Full Screen"
It did the trick for me.
My app is written in python kivy. This is what I did. It worked.
The reason is that I don't have AppIcon and LaunchImage defined.
There is free website that can provides you a set of icons and
launchImages for various devices.
Once you have the full set, usually 2 folders - AppIcon and
LaunchImage folder. Open your Xcode project, General > AppIcon and
Launch images.
In the AppIcon Source, click the arrow on the right. It will go to
another page, in which you can drag and drop the two folders in
(yes, drag the folders).
Go back to the previous General tab, in the AppIcon Source, you can
select your folder, usually called AppIcon-1. And tick 'include all
icon asset'
Leave 'Launch Screen File' blank. This is very different from
previous Xcode version.
Under the deployment info, status bar style, you can tick require
full screen.
After those steps you should be good to load again.
Please note these steps are for a non storyboard app. In my case, my app is written in kivy.
Don't Do anything that are described in earlier answers...
To show view Controller follow the following single step
Step 1 : Add the splash Screen for iPhone and iPad.
After this this error will not come again.

Launch Image does not show up in my iOS App

I want to get a simple launch screen to show in my app, built using Xcode 6.0.1.
I have added a launch screen in two ways: As an XIB (with the default name, LaunchScreen.xib) and as a launchimage set within xcassets.
I have made sure that my "Launch Screen File" is set to LaunchScreen.xib.
I have simulated every device available (e.g., "iPhone5 iOS8" / "iPhone5s iOS8" / "iPhone6 iOS8". Note that only iOS 8 is available within the simulator).
So this has been quite painful for something that should be trivial. Here is what I did:
Use xcassets
I decided to use .xcassets versus the .xib for launch. I deleted the .xib. If you have images.xcassets already in your project then great, otherwise you can add one from File>New>file:
Create a Launch Image Set
Now create at a minimum a launchimage set and icon set in your .xcassets file by right clicking in the navigator area.
Update the App Icons and Launch Images Settings
Then I made sure that the "Apps icon and image sets" in my target are as below.
Very Important: Make sure the "Launch screen file" setting is blank.
Add the Images
Last but not least, the terminology used by Apple for the device selection is confusing. Initially I thought that since I am deploying for iOS8 only (iPhone Portrait), I can do this and just put in the iPhone 6 and iPhone 6+ launch images:
I quickly realized that is not the way this works and I was getting a warning:
"An iPhone Retina (4-inch) launch image for iOS 7.0 and later is required."
So I had to select the iPhone under iOS 7.0 and later as well and add an Image for the iPhone 5s.
So to find out which boxes to check on the right, do not ask the question: What is my minimum iOS and device and device orientation but rather ask:
What devices out there can support my minimum iOS? Now What is the minimum iOS supported on those devices? And make sure you check all of those boxes. So for me, I am targeting iPhone 5s, 6 and 6 Plus at 8.0 but given that iPhone 5s can exist with 7.0, I need to check the 7.0 box as well to show the image placeholder. In other words, the (iOS) check box on the right shows you the minimum iOS version available for that device and you need to click it to show the image placeholder and put an image regardless of whether you are deploying at this iOS version or not.
The LaunchScreen.xib and the info value Launch screen interface file base name are from my experience both placeholders that are created when the project is created. If you would like to use the Images.xcassets exclusively for your launch screens, delete both the LaunchScreen.xib and the info.plist item.
If you provide the info.plist setting you app will use the xib and not your Images.xcassets
Xcode 8:
Images used in LaunchScreen.xib should not be on a .xcassets, try dropping them in the bundle.
Looks like that by the time that the .xib gets loaded, the images in the .xcassets are not yet available.
EDIT: For some opaque reason after adding some localizations, launch screen stopped working, now it works with an image from the assets, extremely weird.
My solution was to create all the launch images.
Then I set the Launch Images Source to the LaunchImage asset, and leave launch screen file blank.
Finally if the project does not have a Launch Screen.xib, then add that file and leave it as is.
For me, it worked when I uninstalled the app and then restarted the simulator.
When installed again, launch image appeared as expected.
This also worked on an actual device.
For the people who are using the Asset Catalog's Launch Image, as I learned this the hardest way, I had this scenario where I was first given a jpg file then I asked them convert it to PNG.
I trusted them enough that I scoured the internet first as to why the launch image wasn't showing and did every solution to no avail, then I tried putting back the old launch image and was working fine, it was there that I thought what I have is not a proper PNG file.
TL;DR: Make sure that you are actually using a proper PNG file, not a file with a renamed extension.
Removing "Launch screen interface file base name" from Info.plist file AND trashing "Launch Screen.xib" worked for me.
Simply removing and reinstalling the app worked for me:
Testing in the Simulator
Delete the app in the simulator.
Quit and restart the simulator.
Run the project again in Xcode.
Testing on Device
Delete the app from the device.
Run the project again in Xcode.
The problem with the accepted answer is that if you don't set the Launch Screen File, your application will be in upscaling mode on devices such as the iPhone 6 & 6+ => blurry rendering.
Below is what I did to have a complete working solution (I'm targeting iOS 7.1 & using Xcode 8) on every device (truly, I was getting crazy about this upscaling problem)
1. Prepare your .xcassets
To simplify it, I'm using a vector .PDF file. It is very convenient and avoid creating multiple images for each resolution (1x, 2x, 3x...). I also assume here you already created your xcassets.
Add your launch screen image (or vector file) to your project
Go to your .xcassets and create a New Image Set. In the Attributes window of the Image, select Scales -> Single Scale
Drag and drop the vector file in the Image Set.
2. Create your Launch Screen file
3. Add your image to your Launch Screen file
Add an Image View object to your Launch Screen file (delete the labels that were automatically created). This image view should refer to the previous .xcassets Image Set. You can refer it from the Name attribute. At this stage, you should correctly see your launch screen image in your image view.
Add constraints to this image view to keep aspect ratio depending on the screen resolution.
4. Add your Launch Screen file to your target
Fianlly, in your Target General properties, refer the Launch Screen file.
Start your app, and your splash screen should be displayed. Try also on iPhone6 & iPhone6+, and your application should be correctly displayed without any upscaling (the Launch Screen file aims to do this).
After several hours frustrated on this, I decided to use this way. It works for both iPhone and iPad (on Xcode 6.1)
File >> New File >> User Interface >> Launch Screen
Create new key/value: "Launch screen interface file base name"/"Your Launch Screen Name" in YourApp-Info.plist
1 picture worths more than thousand words. Please look at below:
I've read about a bug in Xcode 6 which prevents landscape only apps from displaying a launch image.
Try to set images and orientation within Images.xcassets:
There is a bug where Xcode 6 launch images stored in asset files cause iphone landscape only apps on iOS7/iOS8 to display a black launch image. iPad works fine.
http://www.raywenderlich.com/forums/viewtopic.php?f=2&t=10868
Solution:
Use the new Launchscreen.xib for ios8+ onwards. (it is far better)
For ios7 devices to work you simply turn off launch images source and use the old school launch images file names in the plist
iphone5 - Default-568h#2x.png
iphone4s - Default#2x.png
ipad2 - Default-Landscape~ipad.png
ipad retina - Default-Landscape#2x~ipad.png
Painful but works.
B
I have tried everything but solution was extremely simple. Just use .jpg file instead of .png on your LaunchScreen.storyboard. It seems like iOS does not render .png file or relatively big image size at launch screen.
Do what Spectravideo328 answered and:
Try to UNCHECK the iOS 7 and later box and CHECK the iOS 6 and prior box in the asset catalog. There seems to be a bug with the iOS 7 Launch Image.
(These both have the same Launch Images except for the 320x480 one)
Hope this helps, it did help for me!
I set up "LaunchImage" in my asset catalog and simply cleared the "Launch Screen" field et voila ! I had the launch images appear ...
One way is to also add "Launch Screen" (LaunchScreen.xib), paste the image into UIImageView and then set it to "Horizontal Center in Container" and "Vertical Center in Container" in "Align" if you are using Auto Layout.
Screen:
http://i.stack.imgur.com/CfnHT.png
Don't forget to put LaunchScreen.xib into "Launch Screen File".
I had the same issue after I started using Xcode 6.1 and changed my launcher images. I had all images in an Asset Catalog.
I would get only a black screen instead of the expected static image. After trying so many things, I realised the problem was that the Asset Catalog had the Project 'Target Membership' ticked-off in its FileInspector view. Ticking it to ON did the magic and the image started to appear on App launch.
Make sure your images are accurate size according to Apple guidelines.
Make sure, You will select only one option , either launch screen file or Launch Image Source. You can find these two options in Project build settings -> General
My suggestion to you is to select Launch Image Source as Image.Assets. Create splash image assets there in Image.assests folder.
Reference image for right configuration:
If you have changed your launch image from a previous image, and observe the following:
devices/simulators where the app was previously installed, still show the previous image and refuse to show the new one (uninstalling and reinstalling the app doesn't help)
devices/simulators where the app was not previously installed, show the new launch image
It is likely because of the caching of launch image done by iOS. Rebooting the device should solve the problem.
I tried opening a new project, and moving through the same steps you did to set a launch screen.
By default, the .xib was set as "Launch Screen File," and the white screen with a label did show for half a second in the simulator.
I then a "Launch Images Source" and set it to the Images.xcassets which generated with the background images I added to the project. (all good so far)
Rerun the simulator and the launch images don't show...
After deleting the specified "Launch Screen File" and a clean: Product -> Clean, from the top menu, the launch images finally show up.
Maybe that will help?
There is a file 'LaunchScreen.xib' automatically added to your project
Deleting this will shift xCode to using your Default images in Images.xcassets
edited to add
go to App Icons and Launch Images
Launch Screen File should be blank/emtpy
I had a very strange bug. Apparently my launch image source was only set for debug configuration and not release. This resulted in my launch screen appearing when running debug configuration, but when I changed to release I just got a black screen.
I fixed this when I changed my build configuration to release the Launch Image Source button appeared and I had to choose Use Asset Catalog again.
For those who are curious, this is what my project.pbxproj looked like.
...
...
...
XXXXXXXXXXXXXXXXXXXXXXXX /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; <---THIS LINE WAS MISSING
...
...
...
For some reason, I had to change the asset catalog location to "relative to project" for this to work.
I had also deleted the app from my phone and reinstalled, but it was probably the "relative to project" that did it.
* (Xcode 7.2 / Deployment Target 7.0 / Landscape Orientation Only) *
I know is an old question but with Xcode 7.2 I'm still getting the message and I fixed with this:
1) Select PORTRAIT and both landscapes. Add "Launch Images Source" and "Launch Screen File"
2) In your Launch Image select iPhone "8.0 and Later" and "7.0 and Later".
3) Add this code in your appDelegate:
#if __IPHONE_OS_VERSION_MAX_ALLOWED < 90000
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscape;
}
#else
- (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
return (UIInterfaceOrientationMaskLandscape);
}
#endif
4) Add this on your ViewController
#if __IPHONE_OS_VERSION_MAX_ALLOWED < 90000
- (NSUInteger)supportedInterfaceOrientations
#else
- (UIInterfaceOrientationMask)supportedInterfaceOrientations
#endif
{
return UIInterfaceOrientationMaskLandscape;
}
I hope help to somebody else.
This is worked for me. Click LaunchScreen.storyboard then in the right panel you can select "Is Initial View Controller" check box.
LaunchScreen.storyboard -> Is Initial View Controller
I just figured this out. My launch image was not showing up, I get a white screen when launching on a device (iPhone 6, 7+) or testFlight. Fix: Renamed "Landing_screen.png" to just "Landing_screen" removing .png part. The image icon in Xcode changed to white icon and in the launch screen storyboard the image appears as a question mark now. The Launch image now appears and not the white screen. My Setup: I am using Swift 3.1 with Xcode 8.3.1. In LaunchScreen.storyboard I added a simple image view and stretched the image to fit the view controller. I set auto layout constraints Top/Bottom/Leading/Trailing space to superview to 0.
I encountered this bug also with my landscape-only app. Following carlodurso's solution works:
tick the "Landscape" box
drag and drop the image to the place.
For me, it works when I remove LaunchScreen.xib and change it to a storyboard file LaunchScreen.storyboard.

Resources