I have an existing app, that crashes on launch, when running on iPhone X Simulator. (Breakpoint stops on the main.m files).
The app runs fine on iPhone 8 simulator, so it has something to with iPhone X.
Also, it has something to do with the status bar, since the stack shows something with [UIStatusbar _prepareForVisualProviderIfNeeded] before the crash.
Do I need to do something with status bar to run this app on iPhone X Simulator?
Found the answer here: All exception break point is stopping for no reason on simulator
TL;DR: Make sure that all fonts that you specify in your Info.plist under Fonts provided by this application are actually in your application bundle.
UIStatusBar suggests that the crash might be due to your UI design in storyboard. Some constraints in old design conflict with iphone x's new status bar area.
Please check and fix it with the help of the new feature, SafeArea.
New feature for ui constraints: safe area
Related
Device: Physical iPhone X (16.0.2)
A legacy app (Objective C) of my client has worked just fine on iOS 15. On iOS 16 though, the app has suddenly 'shrunken in height'. The app opens as usual but on the top and bottom of the screen, there are black bars, as the app itself seems to be constrained to a certain size.
After some investigation, I found out that the device actually reports its Screen Height to be 480pt (iPhone X). Forcing the UIWindow to have a different size doesn't solve the issue, the app is still constrained to be the same wrong height. It seems the device 'actually believes' to be shorter than it is.
Since this behavior kind of resembles what happens when starting an iPhone app on an iPad (at least I remember seeing something like that some time ago), I was wondering whether or not this behavior is expected as of iOS 16?
If not, I would really appreciate some help here.
EDIT: I learned that +[UIScreen mainScreen] is deprecated as of iOS 16 so using that to initialize the window might be the issue. Though there seems to be no alternative for accessing this info all the way back in the AppDelegate. It was suggested to use self.view.window.windowScene.screen for reading a device's screen size, but sadly this is not accessible in the AppDelegate.
WORKAROUND:
I was not able to find the root cause of the issue but could resolve it by using storyboards to load the initial ViewController. This caused the system to automatically create a window, which was not affected by this weird system behavior.
I am pretty new to iOS development and I am able to create views and controllers. I have been testing using my iPhone and other sizes of iPhone and they look great. I tried once on an iPad but it was a border around the screen like in this image.
I constrained to margins and I did not give any height or width constraints so it could stretch properly. It also looks good on the storyboard viewing so what could I be doing wrong? Can't seem to find any resource online to help.
This is default behaviour when you run iphone app in ipad
This happened because your app is supported iphone only .
Tap on your project and select universal if you want to add support for both iphone and ipad.
Other option is you can check requires full screen check box but it will still show black bar
Note: However you are developing iPhone Only app but it is compulsory to check that everything works fine in ipad because apple review team will also check that in ipad and your app may be rejected if something is not proper
May be you have made an iPhone app. Try to change the setting to Universal app in the xcode settings. Normally iPhone app shows scaled on iPad, which is same as in your case.
Select Projet in xcode -> General Setting
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)
In one of my projects, many built-in assets, such as the clear button in UITextField or UISearchBar objects, the UITableViewIndexSearch image, and the activity indicator in the status bar set by UIApplication.sharedApplication().networkActivityIndicatorVisible don't show at the correct resolution. I've noticed this on iPhone 6 and iPhone 6 Plus devices running iOS 8.4, as well as all of the simulators running iOS 8.4. I have other projects that don't show this issue.
Screenshots are here: http://imgur.com/a/7TMlE
I have experienced this as well, in my case the cause was various view controllers being created too early in the application life-cycle (in the init method of the app delegate, i.e. before didFinishLaunching had been called) and also before the creation of the initial UIWindow.
Moving view controller creation to didFinishLaunching, after the window has been created solved it.
Those are system elements, so that’s pretty weird. Try deleting and re-adding the simulators in the Xcode Devices window: Window → Devices or shiftcommand2.
I would like to make screenshots of my app in IOS-Simulator. This works fine with CMD-S, but I have always black parts in my screen, because the windows is not autosized to the simulated devices screensize.
Is there a way to autosize the window to fit with the screensize of the simulator ?
Screenshot:
The white part is the content of the device. The black is obsolete and is a window from the MAC. When taking the screenshot from this, I still have to cut out the content to have a good screenshot.
This used to happen in earlier to iOS SDKS when you don't set a launch images for all devices.
In your case, I think you don't have the launch screen file set. this can be solved by setting that file at general section in the target's settings.
Alternatively, set launch screen images for all devices.
Check my answer here.
One more thing to try: At the top bar in simulator. choose the
Window menu then Scale and play with those values.
I solved it the following way, but I don't know what was the reason.
I removed the launchscreen as hasan83 suggested. This did not the trick yet.
I restarted the MAC
I started XCode ("Xcode"->"Open Developer Tools"->"IOS Simulator")
I started the ios simulator without starting my app. -> MAC-Windows fit with the simulated device screen
I started my app and now it looks as intended.
Thanks for helping to all involved people !