Unrecognized selector sent to instance NSArrayM [closed] - ios

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 9 years ago.
Improve this question
I'm new to IOS programming. Today i tried implementing UITabBarController, but decided to remove it. Ever since that my app crashes. I'm sure that i've removed the right part of the app delegate since i used ctrl + z. I cant really seem to find out where the app is crashing and why?
Sourcecode:
http://www.codeviewer.org/view/code:3cc0
debugging:
2014-02-24 21:00:26.628 app[1307:70b] -[__NSArrayM objectForKeyedSubscript:]: unrecognized selector sent to instance 0xca716d0
2014-02-24 21:00:26.631 app[1307:70b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayM objectForKeyedSubscript:]: unrecognized selector sent to instance 0xca716d0'
*** First throw call stack:
(
0 CoreFoundation 0x02b235e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x028a68b6 objc_exception_throw + 44
2 CoreFoundation 0x02bc0903 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
3 CoreFoundation 0x02b1390b ___forwarding___ + 1019
4 CoreFoundation 0x02b134ee _CF_forwarding_prep_0 + 14
5 app 0x000627e9 -[MenuViewController viewDidLoad] + 16057
6 UIKit 0x01728318 -[UIViewController loadViewIfRequired] + 696
7 UIKit 0x017285b4 -[UIViewController view] + 35
8 UIKit 0x01752ca9 -[UINavigationController rotatingSnapshotViewForWindow:] + 52
9 UIKit 0x01a7ca60 -[UIClientRotationContext initWithClient:toOrientation:duration:andWindow:] + 420
10 UIKit 0x016582f2 -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:isRotating:] + 1495
11 UIKit 0x01657d16 -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:] + 82
12 UIKit 0x01657be8 -[UIWindow _setRotatableViewOrientation:updateStatusBar:duration:force:] + 117
13 UIKit 0x01657c70 -[UIWindow _setRotatableViewOrientation:duration:force:] + 67
14 UIKit 0x01656d0a __57-[UIWindow _updateToInterfaceOrientation:duration:force:]_block_invoke + 120
15 UIKit 0x01656c6c -[UIWindow _updateToInterfaceOrientation:duration:force:] + 400
16 UIKit 0x016579c3 -[UIWindow setAutorotates:forceUpdateInterfaceOrientation:] + 870
17 UIKit 0x0165afb6 -[UIWindow setDelegate:] + 449
18 UIKit 0x0172c737 -[UIViewController _tryBecomeRootViewControllerInWindow:] + 180
19 UIKit 0x01650c1c -[UIWindow addRootViewControllerViewIfPossible] + 609
20 UIKit 0x01650d97 -[UIWindow _setHidden:forced:] + 312
21 UIKit 0x0165102d -[UIWindow _orderFrontWithoutMakingKey] + 49
22 UIKit 0x0165b89a -[UIWindow makeKeyAndVisible] + 65
23 app 0x00012ecf -[AppDelegate application:didFinishLaunchingWithOptions:] + 1391
24 UIKit 0x0160e355 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 309
25 UIKit 0x0160eb95 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1536
26 UIKit 0x016133a8 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 824
27 UIKit 0x0162787c -[UIApplication handleEvent:withNewEvent:] + 3447
28 UIKit 0x01627de9 -[UIApplication sendEvent:] + 85
29 UIKit 0x01615025 _UIApplicationHandleEvent + 736
30 GraphicsServices 0x0448c2f6 _PurpleEventCallback + 776
31 GraphicsServices 0x0448be01 PurpleEventCallback + 46
32 CoreFoundation 0x02a9ed65 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53
33 CoreFoundation 0x02a9ea9b __CFRunLoopDoSource1 + 523
34 CoreFoundation 0x02ac977c __CFRunLoopRun + 2156
35 CoreFoundation 0x02ac8ac3 CFRunLoopRunSpecific + 467
36 CoreFoundation 0x02ac88db CFRunLoopRunInMode + 123
37 UIKit 0x01612add -[UIApplication _run] + 840
38 UIKit 0x01614d3b UIApplicationMain + 1225
39 app 0x0008f4fd main + 141
40 libdyld.dylib 0x030c370d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)

Did you removed UITabBarController also from your .xib file in Interface Builder?
Did you removed UITabBarController also from your .xib file in Interface Builder?
Check if object - in your case NSDictionary is kind of it's class and key is not null. For example:
- (void)fetchedDataAlerta:(NSData *)responseData {
NSError* error;
NSLog(#"RESP register %#", responseData);
if(responseData ) { //here you have recieved valid info. Without it, next line will crash
NSDictionary* json = [NSJSONSerialization options:kNilOptions error:&error];
In your case
NSData* rawBody2 = [response2 rawBody];
//here check if NSData is not null, nil and is valid add line
if (rawBody2) {
results2 = [NSJSONSerialization JSONObjectWithData:rawBody2 options:NSJSONReadingMutableContainers error:nil];

Related

Objective C++, SIGABRT signal

Im doing an iOS app(actually just copying code) from this tutorial http://hubpages.com/hub/Tutorial-on-Creating-an-IOS-5-SQLite-Database-Application-IOS-5-SQLite
and I can't run my app. Build succeds and then I get signal SIGABRT in my XCode.
2014-08-28 09:04:40.105 Whine2[526:60b] Problem with prepare statement
2014-08-28 09:04:40.109 Whine2[526:60b] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty array'
*** First throw call stack:
(
0 CoreFoundation 0x018d81e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x016578e5 objc_exception_throw + 44
2 CoreFoundation 0x018793f6 -[__NSArrayM objectAtIndex:] + 246
3 Whine2 0x000029bd -[kcbViewController viewDidLoad] + 269
4 UIKit 0x0043633d -[UIViewController loadViewIfRequired] + 696
5 UIKit 0x004365d9 -[UIViewController view] + 35
6 UIKit 0x00356267 -[UIWindow addRootViewControllerViewIfPossible] + 66
7 UIKit 0x003565ef -[UIWindow _setHidden:forced:] + 312
8 UIKit 0x0035686b -[UIWindow _orderFrontWithoutMakingKey] + 49
9 UIKit 0x003613c8 -[UIWindow makeKeyAndVisible] + 65
10 UIKit 0x00311bc0 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 2097
11 UIKit 0x00316667 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 824
12 UIKit 0x0032af92 -[UIApplication handleEvent:withNewEvent:] + 3517
13 UIKit 0x0032b555 -[UIApplication sendEvent:] + 85
14 UIKit 0x00318250 _UIApplicationHandleEvent + 683
15 GraphicsServices 0x038cdf02 _PurpleEventCallback + 776
16 GraphicsServices 0x038cda0d PurpleEventCallback + 46
17 CoreFoundation 0x01853ca5 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53
18 CoreFoundation 0x018539db __CFRunLoopDoSource1 + 523
19 CoreFoundation 0x0187e68c __CFRunLoopRun + 2156
20 CoreFoundation 0x0187d9d3 CFRunLoopRunSpecific + 467
21 CoreFoundation 0x0187d7eb CFRunLoopRunInMode + 123
22 UIKit 0x00315d9c -[UIApplication _run] + 840
23 UIKit 0x00317f9b UIApplicationMain + 1225
24 Whine2 0x0000282d main + 141
25 libdyld.dylib 0x01e21701 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
I understand there is some problem with array, right?
As your error message and code in the link says, there is one array named wines in viewDidLoad of kcbViewController and it is empty. aJust log the array wines before accessing it . If you need to check whether an array is empty, you can check if self.wines.count is 0.

App crashing due to NSInvalidArgumentException but can't find it

My app is crashing upon running it with the following debug:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'NSConcreteMutableAttributedString initWithString:attributes:: nil value'
*** First throw call stack:
(
0 CoreFoundation 0x0000000102a83495 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x00000001027e299e objc_exception_throw + 43
2 CoreFoundation 0x0000000102a832ad +[NSException raise:format:] + 205
3 Foundation 0x00000001023d993e -[NSConcreteMutableAttributedString initWithString:attributes:] + 129
4 myApp 0x0000000100006da5 -[WelcomeViewController viewDidLoad] + 373
5 UIKit 0x000000010148559e -[UIViewController loadViewIfRequired] + 562
6 UIKit 0x0000000101485777 -[UIViewController view] + 29
7 UIKit 0x00000001017902e2 -[UIClientRotationContext initWithClient:toOrientation:duration:andWindow:] + 390
8 UIKit 0x00000001013cbffa -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:isRotating:] + 1109
9 UIKit 0x00000001013cbb9f -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:] + 36
10 UIKit 0x00000001013cbaef -[UIWindow _setRotatableViewOrientation:updateStatusBar:duration:force:] + 101
11 UIKit 0x00000001013cadfe -[UIWindow _updateToInterfaceOrientation:duration:force:] + 377
12 UIKit 0x000000010148970a -[UIViewController _tryBecomeRootViewControllerInWindow:] + 147
13 UIKit 0x00000001013c5b1b -[UIWindow addRootViewControllerViewIfPossible] + 490
14 UIKit 0x00000001013c5c70 -[UIWindow _setHidden:forced:] + 282
15 UIKit 0x00000001013ceffa -[UIWindow makeKeyAndVisible] + 51
16 UIKit 0x000000010138ac98 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1788
17 UIKit 0x000000010138ea0c -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 660
18 UIKit 0x000000010139fd4c -[UIApplication handleEvent:withNewEvent:] + 3189
19 UIKit 0x00000001013a0216 -[UIApplication sendEvent:] + 79
20 UIKit 0x0000000101390086 _UIApplicationHandleEvent + 578
21 GraphicsServices 0x00000001047dd71a _PurpleEventCallback + 762
22 GraphicsServices 0x00000001047dd1e1 PurpleEventCallback + 35
23 CoreFoundation 0x0000000102a05679 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 41
24 CoreFoundation 0x0000000102a0544e __CFRunLoopDoSource1 + 478
25 CoreFoundation 0x0000000102a2e903 __CFRunLoopRun + 1939
26 CoreFoundation 0x0000000102a2dd83 CFRunLoopRunSpecific + 467
27 UIKit 0x000000010138e2e1 -[UIApplication _run] + 609
28 UIKit 0x000000010138fe33 UIApplicationMain + 1010
29 myApp 0x0000000100006b03 main + 115
30 libdyld.dylib 0x00000001033c25fd start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
The problem is that I know for a fact I never used NSConcreteMutableAttributedString I have checked and double checked my code to see if maybe I am missing something but I keep coming up blank, any ideas as to what can be done to fix this problem?
Update
I added an exception breakpoint which told me that the following line was causing my app to crash:
NSMutableAttributedString *thirdGreetingAttr = [[NSMutableAttributedString alloc] initWithString:thirdGreeting attributes:secondGreetingAttrs19];
self.welcomeUserLabel.attributedText = thirdGreetingAttr;
"Ok, odd" I think to myself, this was working just fine 2 weeks ago when I last touched this project, This is the complete code block:
NSDictionary *secondGreetingAttrs19 = [NSDictionary dictionaryWithObjectsAndKeys:fitnestFontBold, NSFontAttributeName, nil];
NSString *thirdGreeting = currentUser.username;
NSMutableAttributedString *thirdGreetingAttr = [[NSMutableAttributedString alloc] initWithString:thirdGreeting attributes:secondGreetingAttrs19];
self.welcomeUserLabel.attributedText = thirdGreetingAttr;
So I go ahead and comment out the 2 lines that are causing the issue, and the app runs just fine. I un-comment the lines back to how it was originally and to my surprise build runs JUST FINE :/ what??? Anyone know what could have happened here?
UPDATE
As the chosen answer says, I realized that this error was happening because my username property was returning a null value.
make sure your thirdGreeting(NSString *thirdGreeting = currentUser.username; ) is not nil value.
I think the thireGreeting is nil, you should change to
NSString *thirdGreeting = (currentUser.username.length>0) ? currentUser.username.length : #"";

terminating with uncaught exception of type NSException? 'NSInternalInconsistencyException' [duplicate]

This question already has an answer here:
Loaded the nib but didn't get a UITableView Exception
(1 answer)
Closed 8 years ago.
Today I ran my code that hasn't had any errors until now. Whenever someone clicks on the middle tab at the bottom the app crashes completely but all the other tabs work fine. Here's the call stack:
2014-07-01 16:27:19.848 Test Web[66180:60b] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UITableViewController loadView] loaded the "lwz-qR-aDm-view-tp0-bK-7dP" nib but didn't get a UITableView.'
*** First throw call stack:
(
0 CoreFoundation 0x017f11e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x015708e5 objc_exception_throw + 44
2 CoreFoundation 0x017f0fbb +[NSException raise:format:] + 139
3 UIKit 0x0050418e -[UITableViewController loadView] + 281
4 UIKit 0x0034f0d3 -[UIViewController loadViewIfRequired] + 78
5 UIKit 0x0034f5d9 -[UIViewController view] + 35
6 UIKit 0x0038711f -[UITabBarController transitionFromViewController:toViewController:transition:shouldSetSelected:] + 407
7 UIKit 0x00386943 -[UITabBarController transitionFromViewController:toViewController:] + 63
8 UIKit 0x00382bed -[UITabBarController _setSelectedViewController:] + 281
9 UIKit 0x00382acc -[UITabBarController setSelectedViewController:] + 180
10 UIKit 0x0038683f -[UITabBarController _tabBarItemClicked:] + 312
11 libobjc.A.dylib 0x01582880 -[NSObject performSelector:withObject:withObject:] + 77
12 UIKit 0x002323b9 -[UIApplication sendAction:to:from:forEvent:] + 108
13 UIKit 0x00232345 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 61
14 UIKit 0x004f6629 -[UITabBar _sendAction:withEvent:] + 479
15 libobjc.A.dylib 0x0158282b -[NSObject performSelector:withObject:] + 70
16 UIKit 0x002323b9 -[UIApplication sendAction:to:from:forEvent:] + 108
17 UIKit 0x00232345 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 61
18 UIKit 0x00333bd1 -[UIControl sendAction:to:forEvent:] + 66
19 UIKit 0x00333fc6 -[UIControl _sendActionsForEvents:withEvent:] + 577
20 UIKit 0x00333c06 -[UIControl sendActionsForControlEvents:] + 48
21 UIKit 0x004fb23d -[UITabBar(Static) _buttonUp:] + 123
22 libobjc.A.dylib 0x01582880 -[NSObject performSelector:withObject:withObject:] + 77
23 UIKit 0x002323b9 -[UIApplication sendAction:to:from:forEvent:] + 108
24 UIKit 0x00232345 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 61
25 UIKit 0x00333bd1 -[UIControl sendAction:to:forEvent:] + 66
26 UIKit 0x00333fc6 -[UIControl _sendActionsForEvents:withEvent:] + 577
27 UIKit 0x00333243 -[UIControl touchesEnded:withEvent:] + 641
28 UIKit 0x00271ddd -[UIWindow _sendTouchesForEvent:] + 852
29 UIKit 0x002729d1 -[UIWindow sendEvent:] + 1117
30 UIKit 0x002445f2 -[UIApplication sendEvent:] + 242
31 UIKit 0x0022e353 _UIApplicationHandleEventQueue + 11455
32 CoreFoundation 0x0177a77f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
33 CoreFoundation 0x0177a10b __CFRunLoopDoSources0 + 235
34 CoreFoundation 0x017971ae __CFRunLoopRun + 910
35 CoreFoundation 0x017969d3 CFRunLoopRunSpecific + 467
36 CoreFoundation 0x017967eb CFRunLoopRunInMode + 123
37 GraphicsServices 0x037e55ee GSEventRunModal + 192
38 GraphicsServices 0x037e542b GSEventRun + 104
39 UIKit 0x00230f9b UIApplicationMain + 1225
40 Test Web 0x000031fd main + 141
41 libdyld.dylib 0x01e38701 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
I've tried looking for a solution to this error and checking back over the storyboard but found nothing out of place. Any ideas on a fix?
UITableViewController needs an UITableView connected to it's view property.
Also make sure that the delegate and datasource are properly connected.
If you use xib, make sure that UITableView connected to fileOwner.tableView property.
You probably use xib file to make interface.

What is this error with logging out a user with NSUserdefaults?

I do not understand why I get this error:
On logout I call this:
-(void)logoutUser {
NSLog(#"Logging out user");
NSString *appDomain = [[NSBundle mainBundle] bundleIdentifier];
[[NSUserDefaults standardUserDefaults] removePersistentDomainForName:appDomain];
}
And before loading the HomeCollectionViewController I call this to check if NSUserDefaults exist in the Navigation controller wrapping it:
-(void)viewDidAppear:(BOOL)animated {
// Get the stored data before the view loads
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
//if values exist then already logged in else take to login screen
if([[[defaults dictionaryRepresentation] allKeys] containsObject:#"userId"]){
NSLog(#"userId found");
} else {
NSLog(#"userId NOT found");
StarterViewController *hc=[[UIStoryboard storyboardWithName:#"Main" bundle:nil] instantiateViewControllerWithIdentifier:#"Starter"];
[self presentViewController:hc animated:YES completion:nil];
}
}
This is the error:
2014-04-28 10:19:38.431 App[2675:60b] Warning: Attempt to present <HomeCollectionViewController: 0xba9dd10> on <SlidingMenuViewController: 0xba94200> whose view is not in the window hierarchy!
2014-04-28 10:19:38.443 App[2675:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** +[NSJSONSerialization dataWithJSONObject:options:error:]: value parameter is nil'
*** First throw call stack:
(
0 CoreFoundation 0x01dff1e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x01b7e8e5 objc_exception_throw + 44
2 CoreFoundation 0x01dfefbb +[NSException raise:format:] + 139
3 Foundation 0x018c4a42 +[NSJSONSerialization dataWithJSONObject:options:error:] + 92
4 Stand 0x00008769 -[HomeCollectionViewController getHomeData] + 297
5 Stand 0x000084a8 -[HomeCollectionViewController viewDidLoad] + 744
6 UIKit 0x0095d33d -[UIViewController loadViewIfRequired] + 696
7 UIKit 0x0095d5d9 -[UIViewController view] + 35
8 UIKit 0x00988509 -[UINavigationController rotatingSnapshotViewForWindow:] + 52
9 UIKit 0x00ccfe3c -[UIClientRotationContext initWithClient:toOrientation:duration:andWindow:] + 420
10 UIKit 0x00884c22 -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:isRotating:] + 1495
11 UIKit 0x00884646 -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:] + 82
12 UIKit 0x00884518 -[UIWindow _setRotatableViewOrientation:updateStatusBar:duration:force:] + 117
13 UIKit 0x008845a0 -[UIWindow _setRotatableViewOrientation:duration:force:] + 67
14 UIKit 0x0088363a __57-[UIWindow _updateToInterfaceOrientation:duration:force:]_block_invoke + 120
15 UIKit 0x0088359c -[UIWindow _updateToInterfaceOrientation:duration:force:] + 400
16 UIKit 0x008842f3 -[UIWindow setAutorotates:forceUpdateInterfaceOrientation:] + 870
17 UIKit 0x008878e6 -[UIWindow setDelegate:] + 449
18 UIKit 0x00961b77 -[UIViewController _tryBecomeRootViewControllerInWindow:] + 180
19 UIKit 0x0087d474 -[UIWindow addRootViewControllerViewIfPossible] + 591
20 UIKit 0x0087d5ef -[UIWindow _setHidden:forced:] + 312
21 UIKit 0x0087d86b -[UIWindow _orderFrontWithoutMakingKey] + 49
22 UIKit 0x008883c8 -[UIWindow makeKeyAndVisible] + 65
23 UIKit 0x00838bc0 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 2097
24 UIKit 0x0083d667 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 824
25 UIKit 0x00851f92 -[UIApplication handleEvent:withNewEvent:] + 3517
26 UIKit 0x00852555 -[UIApplication sendEvent:] + 85
27 UIKit 0x0083f250 _UIApplicationHandleEvent + 683
28 GraphicsServices 0x03bbff02 _PurpleEventCallback + 776
29 GraphicsServices 0x03bbfa0d PurpleEventCallback + 46
30 CoreFoundation 0x01d7aca5 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53
31 CoreFoundation 0x01d7a9db __CFRunLoopDoSource1 + 523
32 CoreFoundation 0x01da568c __CFRunLoopRun + 2156
33 CoreFoundation 0x01da49d3 CFRunLoopRunSpecific + 467
34 CoreFoundation 0x01da47eb CFRunLoopRunInMode + 123
35 UIKit 0x0083cd9c -[UIApplication _run] + 840
36 UIKit 0x0083ef9b UIApplicationMain + 1225
37 Stand 0x0000948d main + 141
38 libdyld.dylib 0x0254b701 start + 1
39 ??? 0x00000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
I think you have made an incorrect assumption as to the cause of the problem. Your HomeCollectionViewController is being loaded, so your user defaults isn't the problem. You can see from the stack trace that this view controller is calling a method getHomeData in its viewDidLoad method. It seems that getHomeData is attempting to retrieve some JSON data but the JSON string is nil - as per the exception message.
You need to investigate this method and work out what is going wrong with your JSON.

How to find the line of the crash?

I have some beginner trouble using xCode. Each time the app crash I find it hard to find the problem as I don't understand the log currently I seem to have a problem with a Array. I think it is a Array of which I deleted the class where it was in.
I would like to know how I should read this log :
2014-05-02 10:49:32.808 myCompany[2793:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
*** First throw call stack:
(
0 CoreFoundation 0x017f21e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x015718e5 objc_exception_throw + 44
2 CoreFoundation 0x017a4abc -[__NSArrayM insertObject:atIndex:] + 844
3 CoreFoundation 0x017a4760 -[__NSArrayM addObject:] + 64
4 UIKit 0x00794a4b PushNextClassForSettingIMP + 383
5 UIKit 0x00794838 __workaround10030904InvokeWithTarget_block_invoke + 29
6 UIKit 0x00284413 +[UIView _performCustomizableAppearanceModifications:] + 26
7 UIKit 0x00794810 workaround10030904InvokeWithTarget + 940
8 UIKit 0x0078ee71 +[_UIAppearance _applyInvocationsTo:window:matchingSelector:] + 3779
9 UIKit 0x0078f633 +[_UIAppearance _applyInvocationsTo:window:] + 55
10 UIKit 0x0029b5a3 -[UIView(Internal) _applyAppearanceInvocations] + 270
11 UIKit 0x0029c002 __88-[UIView(Internal) _performUpdatesForPossibleChangesOfIdiom:orScreen:traverseHierarchy:]_block_invoke + 65
12 UIKit 0x0029bf8f -[UIView(Internal) _performUpdatesForPossibleChangesOfIdiom:orScreen:traverseHierarchy:] + 204
13 UIKit 0x0029bebe -[UIView(Internal) _didChangeFromIdiom:onScreen:traverseHierarchy:] + 52
14 UIKit 0x003f44b7 -[UILabel(_UIAccessibilityButtonShapesSupportInternal) _didChangeFromIdiom:onScreen:traverseHierarchy:] + 73
15 UIKit 0x004ed776 -[UITabBarButtonLabel _didChangeFromIdiom:onScreen:traverseHierarchy:] + 73
16 UIKit 0x0029be82 -[UIView(Internal) _didChangeFromIdiomOnScreen:traverseHierarchy:] + 172
17 UIKit 0x0029b466 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 1624
18 UIKit 0x0029b109 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 763
19 UIKit 0x00334458 -[UIControl _didMoveFromWindow:toWindow:] + 65
20 UIKit 0x0029b109 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 763
21 UIKit 0x004fad59 -[UITabBar(UITabBarPrivate) _didMoveFromWindow:toWindow:] + 65
22 UIKit 0x0029b109 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 763
23 UIKit 0x0029296f __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 158
24 UIKit 0x002927fb -[UIView(Hierarchy) _postMovedFromSuperview:] + 260
25 UIKit 0x0029ddd4 -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1875
26 UIKit 0x00290dba -[UIView(Hierarchy) addSubview:] + 56
27 UIKit 0x00270406 -[UIWindow addRootViewControllerViewIfPossible] + 481
28 UIKit 0x002705ef -[UIWindow _setHidden:forced:] + 312
29 UIKit 0x0027086b -[UIWindow _orderFrontWithoutMakingKey] + 49
30 UIKit 0x0027b3c8 -[UIWindow makeKeyAndVisible] + 65
31 UIKit 0x0022bbc0 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 2097
32 UIKit 0x00230667 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 824
33 UIKit 0x00244f92 -[UIApplication handleEvent:withNewEvent:] + 3517
34 UIKit 0x00245555 -[UIApplication sendEvent:] + 85
35 UIKit 0x00232250 _UIApplicationHandleEvent + 683
36 GraphicsServices 0x037e7f02 _PurpleEventCallback + 776
37 GraphicsServices 0x037e7a0d PurpleEventCallback + 46
38 CoreFoundation 0x0176dca5 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53
39 CoreFoundation 0x0176d9db __CFRunLoopDoSource1 + 523
40 CoreFoundation 0x0179868c __CFRunLoopRun + 2156
41 CoreFoundation 0x017979d3 CFRunLoopRunSpecific + 467
42 CoreFoundation 0x017977eb CFRunLoopRunInMode + 123
43 UIKit 0x0022fd9c -[UIApplication _run] + 840
44 UIKit 0x00231f9b UIApplicationMain + 1225
45 myCompany 0x000043fd main + 141
46 libdyld.dylib 0x01e39701 start + 1
)
EDIT :
this caused the problem :
UIImage *tabBackground = [[UIImage imageNamed:#"image.PNG"]
resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
[[UITabBarItem appearance] setImage:tabBackground];
Still I don't understand why it can't just display the line of error like android. I found this by comment lining
I think you must follow up this tutorial, clearly mentioning about this
http://www.raywenderlich.com/10209/my-app-crashed-now-what-part-1
According to your log details,
You are trying to create array with nil objects.
Trying to insert nil object to array
both above will crash the app.
Enable zombies
Product->Edit Scheme->Diagnostics-> Click Enable Zombie Objects
You forgot to add nil at last index in array creation.
like this
NSArray *array = [NSArray arrayWithObjects:#"1",#"2"]; 
But it should be
NSArray *array = [NSArray arrayWithObjects:#"1",#"2",nil]; 
But If you are using NSMutableArray and add objects,then u should valid to nil condition like below.
if (myObjectToBeAddedToArray!=nil) {
[arrayMutable addObject:myObjectToBeAddedToArray];
}

Resources