iOS App Crashing on iPad Pro only: NSUnknownKeyException - ios

I had a user report my app was freezing at the launch screen on his iPad Pro but working on all other devices -- an iPhone 6 plus and an iPad Mini all runnning iOS 9.2. I've had no crash reports from this release and can also see other iPad devices running the app fine, so I suspected some local file corruption issue. Just as I was writing the user about how to uninstall reinstall, I tried running the app on the iPad Pro simulator. Boom. He was right. Freezes at the Launch screen and throws an exception. (Yes, my inner Bart Simpson is writing 100x on the Blackboard: Test on all simulators before release).
Terminating app due to uncaught exception
'NSUnknownKeyException', reason: '[
setValue:forUndefinedKey:]: this class is not key value
coding-compliant for the key view.'
Elsewhere on Stackoverflow this error has been attributed to a bad outlet. As far as I can tell, no issues there:
or a Viewcontroller having a bad class. I'm eliminating that as a candidate as I don't think that would be a single-device failure, and because my app is built in Cordova it hands over to a webview.
The exception gets thrown in main.m, a cordova-generated file:
#import <UIKit/UIKit.h>
int main(int argc, char* argv[])
{
#autoreleasepool {
int retVal = UIApplicationMain(argc, argv, nil, #"AppDelegate");
return retVal;
}
}
I'd also read about issues of improperly formatted launch screens causing problems, and since the launch screen image I added for iPad Pro is a new addition to my code since last version, this was my first suspect. But I've checked pixel sizes and resolutions and all my launch screen images comply to the specs at Apple's developer site.
So. Any ideas what about the iPad Pro alone would cause a freeze immediately on launch? The app's first step is to look for a file written to local storage -- and to write one if it doesn't find it. Again, unless there's something very different about how the Pro handles local storage, I don't think that can be it as that process works across all other iOS devices. If running on actual hardware will help anyone diagnose, the app's here in the app store, and I'm happy to send a download code.

This was an embarrassingly simple issue: Don't know how, but the main interface box was scrolled to MainViewController.xib for ipad only. For a Cordova app, it should be blank, which it was in the default iPhone view for the Deployment Info page. When I clicked the iPad button the errant selection was revealed. Blanked it, recompiled, all was well.

Related

EXC_BAD_ACCESS(Code=EXC_ARM_DA_ALIGN) Only when running app on device from Xcode

I'm getting a really weird EXC_BAD_ACCESS(Code=EXC_ARM_DA_ALIGN) crash on my app which is written in swift but only when i run it on a 32 bit device and only if its running from Xcode (the device is still hooked to Xcode), If i start the app without Xcode it runs fine. I can't give any code since no matter what i do i get no stack trace or anything like that .Only the mention error on the AppDelegate, even though the crash is in different screens further in the app (crashes on second screen).
Any idea as to why the crash would happen only when Xcode is running the app
You are using some variable or object which is yet to be initialised. Please review your code and you will get the error. You can add exceptional break point to get the actual position of the error.
It's a memory alignment issue. Search on EXC_ARM_DA_ALIGN.
https://brewx.qualcomm.com/bws/content/gi/common/appseng/en/knowledgebase/docs/kb95.html
use memcpy
char*Code; int pc;
double f;
memcpy(Code+pc, &f, sizeof(f)); // instead of *(double*)(Code+pc)=f; that generates EXC_ARM_DA_ALIGN

iOS app crashes immediately when debugging AppleWatch app on Simulator (not on device)

I've got an AppleWatch app that is working fine in Simulator and Device, but when I call openParentApplication, it appears that the parent app is crashing immediately because I see this in the console output:
The UIApplicationDelegate in the iPhone App never called reply()...
When I try to manually launch the parent iOS app in the Simulator it crashes there too immediately. I don't have time to attach the debugger (which is already attached to the AppleWatch app) to see what is crashing it. Note that the parent app runs fine when the AppleWatch is running and I'm using a real iPhone. I can also run the app fine on the Simulator when not debugging the AppleWatch app.
I've tried resetting the Simulator, but problem persists.
I'm just not sure how to debug this. Any help is appreciated.
Start an explicit background task in handleWatchKitRequest. Otherwise, your app gets killed before it reaches reply().
Refer to this post for a code example on how to create a background task.
In turns out that after commenting out all code in the parent app's didFinishLaunching and stripping almost all code out of the watch extension, the problem was indeed at a lower level.
The Simulator has a
Debug | Open System Log...
menu option that showed the crash logs, which contained:
Dyld Error Message: Library not loaded:
#rpath/MyCore.framework/MyCore Referenced from:
/Users/me/Library/Developer/CoreSimulator/Devices/A2061705-DDDF-477C-9AAA-E50GG43A6350/data/Containers/Bundle/Application/DEB7FB25-8233-4B9F-8DAB-9FF8AE42BF33/MyApp.app/MyApp
Reason: no suitable image found. Did find:
/Users/me/Library/Developer/CoreSimulator/Devices/A2061705-DDDF-477C-9AAA-E50FF43A6350/data/Containers/Bundle/Application/DEB7FB25-8553-4B9F-8DAB-9FF8AE95BF33/MyApp.app/Frameworks/MyCore.framework/MyCore:
mach-o, but wrong architecture
My Swift app has a few dependent Swift projects that are used by the app and extension. Getting the Swift frameworks to link has been a major pain. I've included the dependent frameworks (compiled in the same workspace) as embedded binaries. This works when running on the device, or on the Simulator, but not when running in this hybrid watch app + parent app Simulator context.
I changed the embedded binary references to point to the frameworks under ...DerivedData...Debug-iphonesimulator, as opposed to ...DerivedData...Debug-iphoneos, and the problem went away.
Still hoping the Swift framework story will improve.
Are you seeing an actual crash? That message has appeared for me plenty of times without the host app crashing.
99% of the time, that error appears because developers aren't opening a background task to complete their work in handleWatchKitRequest. Without the background task, the OS kills your app in the background before it has a chance to reply.

UINib initWithNibName crash before app load

I have an iOS app that runs fine on the simulator, but crashes on all devices with this error:
<Warning>: *** Assertion failure in -[UINib initWithNibName:directory:bundle:], /SourceCache/UIKit/UIKit-3318.16.14/UINib.m:98
Apr 13 23:24:52 Feifan-Zhous-iPad splashboardd[14537]
<Error>: *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: (name != nil) && ([name length] > 0)'
The app is in Swift, running on Xcode 6.1.1. The device here is an iPad Mini 4,4 running iOS 8.1 (but the crash happens on all devices including iPhones, ranging from iOS 7.0 upwards).
Notable is the crash happens before the app launches (application:didFinishLaunchingWithOptions: never gets called) and an exception breakpoint in Xcode doesn't catch anything.
The app uses a Main.storyboard file as the Main Interface file. It is not red in the Copy Bundle Resources phase. The app isn't using initWithNibName:directory:bundle anywhere.
Has anyone run into this error and found a fix? Very little to work on
I have an iOS app that runs fine on the simulator, but crashes on all devices
It looks like it must be something with capitalization of a file name. I suppose that you have installed case insensitive file system on your mac so a simulator treats name "File" as "file" (and even "FILE") while iOS devices has case sensitive file systems so file names are case sensitive.
I suppose that you've set incorrectly class name for your initial view controller and it cannot be instantiated.
You are probably initializing a nib name in initWithNibName:directory:bundle which isn't ever being called.
Move the your initialization code from initWithNibName:directory:bundle to awakeFromNib.
I had the same issue, check in the rootViewController/InitialView if you are registering a nib file with a wrong file/reference name. Had that when I registered UICollectionViewCells in viewDidLoad while making a network call, didn't show where the crash was.

iOS app crashing immediately

My iOS app is crashing immediately without any debug info. I have a break point all objective-c exceptions.
Crashing on this line
return UIApplicationMain(argc, argv, nil, NSStringFromClass([STAppDelegate class]));
App was running fine for the past month and nothing was changed.
I cleaned are re-ran.
What is weird is it is crashing every other time I run so run once its good stop it and run again crashed .... repeat rinse same result... every other time.
I am getting closer after installing 4.6.2. Now it crashes everytime and I get this error."erminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named UIStoryboardUnwindSegueTemplate'"
This is an altogether different story, it looks like a problem similar to use autolayout on iOS version lower than 6.x...
You cannot use storyboard with iOS 5.x as deployment target.
Getting back to your original problem, Xcode 4.6.2 app crashes on every second run, it gets solved either updating to the latest XCode 4.6.3 or using GDB instead of LLDB. I suggest, however, to update to the latest version and hence use LLDB - by the way, it looks like the next XCode 5 will support exclusively LLDB.

iPad app closes after 2 seconds, memory issue?

I made a magazine iPad app so you can scroll through different slides to the left, right, down and up. It's all ready and accepted by the iTunes app store. Problem is, if someone downloads the app it closes directly after 1 seconds of loading.
Weird part is that i installed the app trough xCode and all works without any problems. My guess is that the app takes too much memory. I made a screenshot of the memory instrument:
But how can i release a Srollview if it must be loaded all the time?
Hope someone could push me in the right direction!
I have tested your app on my iPad2 with iOS 5.1.1, and it crash with the following message:
OxygenEvents[97151] <Error>: *** Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named NSLayoutConstraint'
*** First throw call stack:
(0x375c388f 0x31638259 0x375c3789 0x375c37ab 0x309de54d 0x309de6bb 0x309de423 0x3096f001 0x308dd3c7 0x307bac59 0x30730c17 0x10d5d5 0x30730c8b 0x109beb 0x30730c8b 0x3072f461 0x30721e87 0x307927d5 0x10960b 0x3072fcab 0x307297dd 0x306f7ac3 0x306f7567 0x306f6f3b 0x3771322b 0x37597523 0x375974c5 0x37596313 0x375194a5 0x3751936d 0x3072886b 0x30725cd5 0x10944f 0xf0050)
It is because you use "Autolayout" in your Interface Builder files (nib / xib files), which is an iOS 6.0 only feature.
To solve this, either disable Autolayout in all your xib files like this:
or simply make your app iOS 6.0 only by setting deployment target as iOS 6.0

Resources