auto layout in Xcode 5 ios 7. How to create app that works in both iphone 4 and iphone 5 - ios

I own an iphone 4 device and do not have immediate access to iphone 5. I am using the simulator to test things out. I have already tested my app on iphone 4 and its simulator and it looks fine. When I run the app on iphone 5 screens (4-inch screen simulator), the app does not seem to work and I get two black empty spaces on top and bottom (see below):
I suspect there is more to making an app for both iphone 4 and iphone 5 than switching autolayout on (which is the case for me.) I am going to read up on autolayout more now but thought I would throw this in here to confirm if I am not missing something obvious.
Thanks!
UPDATE:
To solve this issue, you need to generate a launch image of size 640X1136. The question is how do you do that since in the simulator you would need this image for it to work properly? The solution is to generate ANY picture of dimension and make it the Default#2x image. LAunch simulator - the app would look normal now. Now you can go ahead and generate a "REAL" launch image of this size and replace the dummy one!

To solve this issue, you need to generate a launch image of size 640X1136. The question is how do you do that since in the simulator you would need this image for it to work properly? It is a chicken and egg problem. The solution is to generate ANY picture of dimension and make it the Default#2x image. LAunch simulator - the app would look normal now. Now you can go ahead and generate a "REAL" launch image of this size and replace the dummy one!

Related

iPhone application pixelated on iPhone

I've two live apps on Appstore, my one app is looking quite blurry on iPhone 11(which I just bought) and its fine previous models of iPhone, but my another app looks fine on iPhone 11.
The first app which is blurry is built on xib file and base screen size of iPhon SE and second app which look fine is built on storyboard and base screen size is iPhone 8 but I think that may not be the reason.
Blurry App on iPhone 11 (as it look pixelated)
Blurry App on iPhone 8(as it looks fine and crisp)
Xib file of Blurry App
Let me know why this is happening and whats the solution ? Do I need to revamp all screens in project? Looking for suggestions.
Thanks
Finally I found solution and the culprit was iOS 8.0 and Later check. It was unchecked, which I marked checked and added Splash screens for these defined sizes and my whole apps screens became crisp from pixelated.

iPhone app does not work correctly on iPad after change from universal to iphone only

How can I run iPhone apps on iPad after changing the target from an initial 'Universal' to 'iPhone'?
I'm working on a game for iOS (iPhone) using Swift and SpriteKit. The game got rejected today for this reason:
Reasons for Rejection: 2.10: iPhone apps must also run on iPad without
modification, at iPhone resolution, and at 2X iPhone 3GS resolution
After searching on StackOverflow I found out that it might have something to do with my info.plist file because at first my app was 'universal' and later I've changed it to iPhone-only.
It seems like there's something wrong with the aspect ratio of all the nodes. Take a look at the screenshots below. At the left side is the iPad-simulator and on the right there's the iPhone-simulator.
Maybe the game still thinks it is running on iPad because the nodes appear in 4:3 ratio?
How can I run iPhone apps on iPad after changing the target from an initial 'Universal' to 'iPhone'?
Please help. Thanks!
I've also added a screenshot of my info.plist file.
Apple requires that each app targeted on iPhone should run on iPad in the specific manner.
This usually looks like the app on iPad is not full-screen, it's surrounded by black frame that resembles the situation that the iPad is simulating iPhone.
My suggestion is to use size class now to make the app run full-screen on iPad and this should fix your issue with Apple.
Simply choose in your storyboard Regular Width and Regular Height, delete the existing constraints and set new ones.
More help here and apple docs also might come in handy
Darvydas' comment solved my problem.
What size does your background node have? Also if you whant your app
run only on Landscape delete those 2 (Item 0, Item 1 PORTRAIT)

iOS 9 Splash screen is black

My apps' splash screens are all plain black after upgrading to iOS9.
Does anybody know why this is? Some of them are using a .xib splash screen and some are using images, but they're all just black now. Does an app have to be built with Xcode 7 for the splash screen to work in iOS9? Has anyone seen some documentation on whether this is an intended breaking change from Apple?
Thank you!
UPDATE: Looking through the apps again it seems my older apps, which only had a Launch image and no .xib are still displaying correctly, so the issue seems related to the launch screen .xib
UPDATE2:
As hagi pointed out in the comment, after re-installing the very same binary it starts working again so the cause is probably that launch images are generated from the xib whenever the app is installed, and stored somewhere, and then when upgrading to iOS9, for some reason (unintended Apple bug most likely), the generated images are cleared, and the app ends up with no splash. And that's why the old-fashioned launch images are still safe and not affected by this, cause they're already baked into the app.
I'll report it as a bug to Apple.
Easy fix. No need to mess with anything. Xcode 7 just prefers the images to be "Universal".
Click on Assets.xcassets folder
Click the + sign to Import from Project.
Select all images
Done. Now your launch screen works and Xcode is happier.
Same problem here after I updated to iOS 9. Re-installing the app from the App Store seems to solve the problem. I guess, it's an iOS 9 glitch.
I had the exact problem and had a black launch screen after using Xcode 7, and at first re-adding the images in Launch-Screen.xib worked but it went black again.
I fixed this permanently by moving the images referenced by Launch-Screen.xib into an asset catalog, rather than using the png filenames.
Just to point out that once again (as this solution didn't appear in answers, and I've personally lost around two hours when "fixing" that), sometimes, especially when the app is in active development/debugging, it requires iOS device to reboot for the launch screen to be fixed.
Black screen default come because, iOS strictly enforces some a startup images it can be black or any images.
Use UILaunchImages key to the Info.plist file and use a dictionary to describe each launch image.
check following references
A launch storyboard or xib must be provided unless the app requires full screen
I am using xcode7.1 it works. Please download latest xcode7.1
I hope above information will help you.
In the storyboard 'Clears Graphics Context' box unchecked then It works.
What worked for me was
1 - Go to LaunchScreen.storyboard
2 - Select is the initial view controller
enter image description here
And you are good to go.
With me uninstalling the app, or rebooting the device didn't help. I used XCode for 5 more minutes, which is the mean time between failure in XCode and it gave "Unkown error occurred" error, which was very helpful. Of course as an experienced XCode developer I knew what to do, force-quit, clean the project, rebuild.
The first error was solved meanwhile as I had forgotten about that.
The problem maybe because missing image size: .png, #2x.png, #3x.png at LaunchScreen.xib
I made loading screen by LaunchScreen.xib
In this xib has load a image launch.png
But there are missing size launch.png, just exist launch#2x.png and launch#3x.png
After add missing image: launch.png, black square bug is gone.
Starting from iOS9 and Xcode 7 you are required to provide a LaunchScreen.storyboard for your launch screen in order to support the new multitasking feature on iPad.
To opt out of being eligible to participate in Slide Over and Split View, add the UIRequiresFullScreen key to your Xcode project’s Info.plist file and apply the Boolean value YES.
I have fixed this issue after removed Size Classes for LaunchScreen.xib
I used only Auto Layout for it.
I noticed the same issue on the launch screen and have a black square in the middle of the screen.
It might be due to missing images at the specified formats .e.g #2x, #3x etc.
I had the same problem. I downloaded Xcode 7 and upgraded my project to swift 2.0. After recompiling the issue was gone at first but then it started to happen again later on during my tests on other unrelated code.
So far two things get this fixed, in both cases temporarily. Remove the background image, add the same image with another name. New image works for a while. Second, is you resize the image view, and in most cases the image starts to work again, but only for a while.
I submitted my new update to iTunes connect while I was seeing the splash screen. Not sure if this is an operating system issue or app api issue that gets corrected with a recompilation of code.
I also tried enabling and disabling the new Bitcode feature but that didn't help.
I had the same issue with the new iOS 9 project I built using Unity (5.2). To fix that I added the image that I want to show as the launch image to the LaunchScreen-iPad.xib file's Image view.
The common solution of adding the Images in LaunchImage and setting it in Launch Image Source and deleting the entry in Launch Screen File did not solve my issue. The launch image is dependent on the iPhone you are using. Since my app was for iOS 8.0 and greater, choosing it in LaunchImage will ask you to upload only Retine 4.5" and Retina 5.5" images. But these sizes will work for iPhone 6 and 6 Plus. You should upload the images based on the device.
iPhone 4S:640 x 960 (#2x)
iPhone 5:640 x 1136 (#2x)
iPhone 6: 750 x 1334 (#2x) portrait, 1334 x 750 (#2x) landscape
iPhone 6 Plus: 1242 x 2208 (#3x) portrait, 2208 x 1242 (#3x) landscape
I wasted so much time solving the black screen launchimage issue. Hope this helps someone.
We always need to add proper size of image if we are using image.Assets for Launch image and select correct options for launch image Source on Clicking project navigator>General>AppICons and launch images > launch image Source > BrandAssets
If size of launch image is not correct with respect to device on which you are try to running app, then your app will run as iPhone 4 showing black top and bottom bars.
Resizing the image and changing the format to png fixed it for me :
Resize the images (1x => 500 × 825) (2x&3x => 600 × 991)
Change to png
Clean building folder and Derived Data
Restart xcode and simulator

iPhone 6 - app does not fill screen

Most of my apps scale up when run on an iPhone 6, but for some reason one of my apps looks like this:
What would cause it to not just scale up and fill the screen?
EDIT: Here are some repro steps:
Create a new project (Single View). Turn off size classes and just use iPhone.
Make the background orange.
Add a yellow UIView subview at (20,20,280,200).
In Xcode you get this:
Now simulate on iPhone 6. You get this:
Why doesn't it just scale up and look normal?
Not sure why this is getting downvoted. It's a legitimate question. And here's the legitimate answer:
Remove the "Launch Screen File" in Projects > General. Xcode 5 did not have this so older apps scale up automatically. Apps created with Xcode 6 get a default Launch Screen file created.
Removing it will make your app scale up on iPhone 6.
I have got the same problem and I managed to solve it by adding constraints to my ViewController in the storyboard.
Make sure that you clicked the ViewController of your scene. They yellow button in the this screenshot.
Click Editor-> Resolve Auto Layout issues -> Add Missing Constraints
Now you will find that the background image is scaled up to fill iPhone 6 or iPhone 6 plus.
Note that this solution works for me even if I did not provide any launch screen file.
I had the same issue. Searching for an answer, most of them mention the launch image. To me, what did the trick, was that I first enabled launch image for iOS8.0 and later in Xcode, which requires the native resolution sizes for 4.7" and 5.5". Adding these sizes didn't help, but when I re-disabled them, it started working!
If you do have any launch image, you will need launch images for all appropriate sizes. I was doing a minor update to an app, and it was not showing correctly on the iPhone 6 simulator. I created four launch images (.png files). Since the app should still run on iOS 7, I apparently could not use an asset catalog. I gave the images the correct names, and all is good.
Image sizes and names may be found here:
Sizes and Naming of Launch Image for iPhone app in iOS8

ios app not fitting iphone 5 screen

My ios app does not fit on iphone 5 screen. When I run the app, I can see blank space at the top and bottom of the screen. I have made the app compatible for both iphone sizes. But Since I have updated to the latest xcode, I am facing this issue. See screen shot. Can any one please help?
You probably may not have set your Default-568h image.
On the simulator make sure you have set to iPhone (Retina 4-inch).
You can do this by going simulator menu at the top go to Hardware->Device->iPhone (Retina 4-inch) that will change the phone simulator to the iPhone 5 version.
click here for more get information for naming convention of images [here]Naming convention for iPhone 5 images? [here]
Try setting AutoresizingMask to your container views instead of assigning appFrame.
I have faced the same problem while moving to iOS 7.
Solution comes with AutoresizingMask. iOS 7 has full Screen layout for ViewControllers.

Resources