I had tested my app on iPhone models, not iPads - I assumed that if it ran on an iPhone it would run on an iPad in "compatibility mode"... Oh well. So it got rejected. I ran it on the iPad simulator as soon as I got that rejection (I was pissed), and sure enough, it crashes... But it doesn't give me any info as to why. The log window simply shows (lldb) and it crashes here:
int main(int argc, char * argv[]) {
#autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}
Looking at other answers directed me to change "Supported Devices" in the plist but my plist doesn't have that included.
In my launch images and icons assets file, I don't include iPad images - could that be the problem? Others have also recommended removing the main.storyboard file.
In your Xcode project, go to the breakpoints navigator (cmd-7), at the bottom of the screen hit the + and "Add Exception Breakpoint".
Now when you build and run, Xcode should break at the line that's actually causing the crash instead of just in the main().
Note: You can right click on the "All Exceptions" breakpoint and hit "Move breakpoint to...User" so that breakpoint will always be there for all your projects.
Related
I have recently updated Xcode to version 10, and now my console displays:
MyApp[1618:133310] [AXMediaCommon] Unable to look up screen scale
MyApp[1618:133310] [AXMediaCommon] Unexpected physical screen orientation
MyApp[1618:133310] [AXMediaCommon] Unable to look up screen scale
MyApp[1618:133310] [AXMediaCommon] Unable to look up screen scale
MyApp[1618:133310] [AXMediaCommon] Unexpected physical screen orientation
This only happens when I am running the app in the simulator. I have not changed my code since updating, and nothing appears to have broken in the app. What do these logs mean, and how can I resolve them?
I've met the same problem. Finally I find out that this is because I accidentally resize the simulator's screen using my mouse cursor. By quiting and restarting the simulator my problem is solved.
Hope the aforementioned information helps.
This won't answer your original question, but it might relieve your eyes.
A caveat to this answer however is that it disables all NSLog statements.
Do the following to suppress - all NSLog statements including - the warning: Unable to look up screen scale:
In Xcode, go to Product - Scheme - Edit Scheme, select 'Run' on the left side ...
... and add OS_ACTIVITY_MODE with value "disable" in the Environment variables section.
It could sounds dummy, but these warning appeared me after move the simulator previously rendered from the Macbook screen, to a wider external screen.
I solved it just restarting the simulator in the external screen. My 2 cents.
I encountered this issue after running some UITest from a gitlab-runner.
The simulator got into this state and the only way to solve it was to go to Hardware -> Erase all content and settings
Resizing the simulator's screen size to actual device size resolved this for me:
Cmd+1 is the shortcut.
I got the issue, when I was running on iOS 12.2 and MacOS Majove (Version 10.14.4)
Just change to iOS 11.4 and everything working perfectly.
I've experienced something similar. If restarting simulator doesn't do the trick, check your UI test code. Make sure your setup calls super.setup() somewhere:
override func setup() {
super.setup()
// ....
}
My universal iOS app displays the message
[ApplicationLifecycle] Windows were created before application
initialzation completed. This may result in incorrect visual
appearance.
Right at the start of launch - before didFinishLaunchingWithOptions is reached. The app does not crash although there is an issue later where a screen is unexpectedly blank - not sure why.
The app does not display this message on an iPhone.
The iPad uses a splitviewcontroller (actually a custom one).
It is written in objective-C with a mainWindow.xib, as opposed to storyboard.
Can anyway offer any suggestions as to how to determine what is causing this issue.
I was having the same problem, the error will show only on ipad size 10.5 or bigger, i don't know if this will help you, in my case was caused by the launchImage. To solved I changed in settings - target - general, in the field - Launch screen file - set it to = LaunchScreen, and then in I dragged an image view on LaunchScreen.storyboard and load a LaunchImage.png in the image field.
In addition to PabloT.'s answer:
In your target settings, look for General - App Icons and Launch Images and see if the Launch Screen File is blank. You should set it to your mainWindow.xib.
This will not only solve this issue, it will also help to adjust your app to bigger iPad screen sizes.
What worked for me: You have to keep a reference to UIWindow, because when returning from didFinishLaunching, the temporary UIWindow *window is lost.
This means:
#interface AppDelegate ()
{
UIWindow *myWindow;
}
#end
I stopped receiving this error when I deleted the Launch Screen.xib left over from my Swift conversion.
The original app was in Objective-C, which required the xib file. After completing conversion recently, I started receiving the subject error message.
I deleted the Launch Code.xib, cleaned everything, and rebuilt. I haven't received the error since.
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
I had created a new project with one class MainViewController, and that viewController containing just an NSLog statement in the ViewDidLoad method.
I noticed that when checking the memory and CPU status, that the memory reached 31.0 MB after i ran the app on the simulator, and that was HUGE for an empty project with no resources !!!
You can notice that from the bellow screen shot for the Xcode:
My project is for iPad only, and support iOS 6 and above, and i used Empty Application template
Please Advice.
I'm having an odd problem drawing an NSString on the iOS simulator. Every few runs on the simulator, my app will crash with an "EXC_BAD_ACCESS" signal when execution reaches the following piece of code:
[month drawInRect:tFrame withFont:font lineBreakMode:UILineBreakModeClip alignment:UITextAlignmentCenter];
The "month" string isn't being declared incorrectly, I've set it directly before the above line and printed it with expected results, so the bad access is not related to the NSString object.
However, the really strange part of this is that it has never crashed when running on an actual device. Is this just a different in how signals are sent to applications on a device vs. the simulator?
I originally suspected that the problem lied in the font or font size that was being used, am I correct in guessing that? The font size is a little strange as it's being dynamically created. At the time of the crash, the size is '16.8286057'. However, I've casted it to an int to truncate it, and I still receive crashes. (again, no crashes on devices either)
How can I make this code more robust to fix this so I can confidently run this app on the simulator?