My code looks like this:
CGRect screenRect = [[UIScreen mainScreen] bounds];
SomeView *infoView;
if(screenRect.size.height != 568.0){
// iPhone 5/5s users crash in the next line
infoView = [[[NSBundle mainBundle] loadNibNamed:@"SomeViews" owner:self options:nil] objectAtIndex:1];
}else{
infoView = [[[NSBundle mainBundle] loadNibNamed:@"SomeViews" owner:self options:nil] objectAtIndex:0]
}
However, I get some crash reports from Crashlytics for iPhone 5/5s users as comment in the above code.
I am surprising that the height is NOT 568 for 5/5s since my app only supports Portrait orientation. I have hundreds of active users and only 12 crashes happened on 4 users.
And even if a iPhone 5/5s device load the wrong nib(for 3.5inch screen), it should not cause crash. (I just tested.)
http://crashes.to/s/1ddc169b801
Crashlytics also shown me that 90% of the crashes are on jailbreak devices, which makes me wonder that if jailbreak devices can change this value in any way?
Fatal Exception: NSInvalidArgumentException
-[UIDeviceRGBColor superview]: unrecognized selector sent to instance 0x14732db0
0
CoreFoundation
__exceptionPreprocess + 130
1
libobjc.A.dylib
objc_exception_throw + 38
2
CoreFoundation
-[NSObject(NSObject) doesNotRecognizeSelector:] + 202
...
22
UIKit
-[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 138
23
Banck
BKAddRecordPagingViewController.m line 244 // line 244 is loadNibNamed
-[BKAddRecordPagingViewController viewDidLoad]
The crash report link shows the reason but I can't figure out why since I use only built-in UILabel, UIImageView, UITextView in the nib file.
Can anyone give me some advice to better check and if using 4 inch screen on jailbreak devices? The second question is that what caused the crash inside loadNibNamed?
superview
. So perhaps something on Jailbroken phones is altering nib loading? – SchottischeinitWithCoder
orawakeFromNib
. – Tymon