App crashing due to NSInvalidArgumentException but can't find it - ios

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 : #"";

Related

Moving Swift iOS app to support Apple TV as a new Target

Maybe somebody can help, I'm trying to move my app to facilitate a new target for the Apple TV.
I create the new Storyboard and linked everything the same way as it has been in the iOS application. When I'm trying to start the application I get the following exception, after the AppDelegate is executed (before it goes into the viewDidLoad of the initial controller.
Any ideas?
2015-09-19 12:24:44.629 App TV[46733:3797033] *** Terminating app due to uncaught exception 'CALayerInvalid', reason: 'layer <CATransformLayer: 0x7fc1e0d51fc0> is a part of cycle in its layer tree'
*** First throw call stack:
(
0 CoreFoundation 0x000000010e850105 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010f271deb objc_exception_throw + 48
2 CoreFoundation 0x000000010e85003d +[NSException raise:format:] + 205
3 QuartzCore 0x0000000111d2f74a _ZN2CA5Layer30ensure_transaction_recursivelyEPNS_11TransactionE + 102
4 QuartzCore 0x0000000111d2f795 _ZN2CA5Layer30ensure_transaction_recursivelyEPNS_11TransactionE + 177
5 QuartzCore 0x0000000111d2f795 _ZN2CA5Layer30ensure_transaction_recursivelyEPNS_11TransactionE + 177
6 QuartzCore 0x0000000111d2f795 _ZN2CA5Layer30ensure_transaction_recursivelyEPNS_11TransactionE + 177
7 QuartzCore 0x0000000111d37439 _ZN2CA5Layer15insert_sublayerEPNS_11TransactionEP7CALayerm + 389
8 QuartzCore 0x0000000111d3782a -[CALayer addSublayer:] + 193
9 UIKit 0x000000010d2ce424 -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1512
10 UIKit 0x000000010d5b1b56 -[UIButton initWithCoder:] + 1424
11 UIKit 0x000000010d79dd62 UINibDecoderDecodeObjectForValue + 705
12 UIKit 0x000000010d79da98 -[UINibDecoder decodeObjectForKey:] + 278
13 UIKit 0x000000010d5d1315 -[UIRuntimeConnection initWithCoder:] + 134
14 UIKit 0x000000010d5d1a77 -[UIRuntimeEventConnection initWithCoder:] + 60
15 UIKit 0x000000010d79dd62 UINibDecoderDecodeObjectForValue + 705
16 UIKit 0x000000010d79df23 UINibDecoderDecodeObjectForValue + 1154
17 UIKit 0x000000010d79da98 -[UINibDecoder decodeObjectForKey:] + 278
18 UIKit 0x000000010d5d0555 -[UINib instantiateWithOwner:options:] + 1255
19 UIKit 0x000000010d3ad7f2 -[UIViewController _loadViewFromNibNamed:bundle:] + 381
20 UIKit 0x000000010d3ae11e -[UIViewController loadView] + 178
21 UIKit 0x000000010d3ae47d -[UIViewController loadViewIfRequired] + 139
22 UIKit 0x000000010d3aec7e -[UIViewController view] + 27
23 UIKit 0x000000010d289484 -[UIWindow addRootViewControllerViewIfPossible] + 61
24 UIKit 0x000000010d289b81 -[UIWindow _setHidden:forced:] + 302
25 UIKit 0x000000010d29b558 -[UIWindow makeKeyAndVisible] + 43
26 UIKit 0x000000010d216063 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4131
27 UIKit 0x000000010d21c5a8 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1755
28 UIKit 0x000000010d219783 -[UIApplication workspaceDidEndTransaction:] + 188
29 FrontBoardServices 0x000000011097b7ac -[FBSSerialQueue _performNext] + 192
30 FrontBoardServices 0x000000011097bb1a -[FBSSerialQueue _performNextFromRunLoopSource] + 45
31 CoreFoundation 0x000000010e77c1b1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
32 CoreFoundation 0x000000010e7720dc __CFRunLoopDoSources0 + 556
33 CoreFoundation 0x000000010e771593 __CFRunLoopRun + 867
34 CoreFoundation 0x000000010e770fa8 CFRunLoopRunSpecific + 488
35 UIKit 0x000000010d2190d5 -[UIApplication _run] + 402
36 UIKit 0x000000010d21de09 UIApplicationMain + 171
37 App TV 0x000000010d0b8fdd main + 109
38 libdyld.dylib 0x00000001149699e9 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Funny thing happening, apparently the new Apple TV (4th Gen / tvOS v9.0) can't handle 'Word Wrap' on a button, after setting it to 'Truncate Middle' it starts up fine. Maybe an issue in the beta.
On Xcode 7.2 I had this same error caused by setting the Line Break on a button to 'Character Wrap'. Changing to 'Truncate Middle' stopped the crash.
You can be notified where the exception occurs by activating Exception Breakpoints, then you will be able to see what happens.
You can do so by going on the Breakpoint navigator on Xcode, then on the Plus button at the bottom left.

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.

iOS 7.1 update crash when switching between uitextfields with reason setObjectForKey: object cannot be nil (key: NSShadow)

We have a failry complex mobile application that uses a static table view for input. With the update to ios 7.1 we are now getting a crash after a user goes through a few text fields without entering information, then enters something and moves to the next text field. The crash is
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: ' setObjectForKey: object cannot be nil (key: NSShadow)'
with this stack trace:
* First throw call stack: (
0 CoreFoundation 0x000000010342b495 exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010318a99e objc_exception_throw + 43
2 CoreFoundation 0x00000001034aa544 -[NSDictionaryM setObject:forKey:] + 916
3 UIKit 0x0000000101eb877c -[UILabel setShadow:] + 339
4 UIKit 0x0000000101eb88b5 -[UILabel setShadowColor:] + 100
5 CoreFoundation 0x0000000103420f1c invoking + 140
6 CoreFoundation 0x00000001034b0e84 -[NSInvocation invokeUsingIMP:] + 212
7 UIKit 0x00000001021f0b4d workaround10030904InvokeWithTarget_block_invoke + 88
8 UIKit 0x0000000101d7eecb +[UIView _performCustomizableAppearanceModifications:] + 33
9 UIKit 0x00000001021f0ae3 workaround10030904InvokeWithTarget + 938
10 UIKit 0x00000001021ebfc9 +[_UIAppearance _applyInvocationsTo:window:matchingSelector:] + 3482
11 UIKit 0x0000000101d938fa 88-[UIView(Internal) performUpdatesForPossibleChangesOfIdiom:orScreen:traverseHierarchy:]block_invoke + 63
12 UIKit 0x0000000101d93885 -[UIView(Internal) _performUpdatesForPossibleChangesOfIdiom:orScreen:traverseHierarchy:] + 230
13 UIKit 0x0000000101d92e2c -[UIView(Internal) _didMoveFromWindow:toWindow:] + 1369
14 UIKit 0x0000000101d8b996 45-[UIView(Hierarchy) postMovedFromSuperview:]_block_invoke + 128
15 UIKit 0x0000000101d8b85c -[UIView(Hierarchy) _postMovedFromSuperview:] + 276
16 UIKit 0x0000000101d952ac -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1508
17 UIKit 0x000000010237d922 -[UITextField willDetachFieldEditor:] + 96
18 UIKit 0x0000000101e1b48e -[UIFieldEditor becomeFieldEditorForView:] + 236
19 UIKit 0x0000000102375497 -[UITextField _resignFirstResponder] + 197
20 UIKit 0x0000000101e6b212 -[UIResponder resignFirstResponder] + 128
21 UIKit 0x00000001023752db -[UITextField resignFirstResponder] + 114
22 UIKit 0x0000000101e6b011 -[UIResponder becomeFirstResponder] + 297
23 UIKit 0x0000000101d8b673 -[UIView(Hierarchy) becomeFirstResponder] + 99
24 UIKit 0x0000000102374b08 -[UITextField becomeFirstResponder] + 51
25 UIKit 0x0000000102067d01 -[UITextInteractionAssistant(UITextInteractionAssistant_Internal) setFirstResponderIfNecessary] + 187
26 UIKit 0x0000000102069b30 -[UITextInteractionAssistant(UITextInteractionAssistant_Internal) oneFingerTap:] + 1768
27 UIKit 0x000000010205ffc2 _UIGestureRecognizerSendActions + 188
28 UIKit 0x000000010205ef28 -[UIGestureRecognizer _updateGestureWithEvent:buttonEvent:] + 357
29 UIKit 0x00000001020632d9 UIGestureRecognizerUpdate_block_invoke + 53
30 UIKit 0x0000000102063261 _UIGestureRecognizerRemoveObjectsFromArrayAndApplyBlocks + 257
31 UIKit 0x000000010205b337 _UIGestureRecognizerUpdate + 93
32 UIKit 0x0000000101d6fa15 -[UIWindow _sendGesturesForEvent:] + 928
33 UIKit 0x0000000101d706d4 -[UIWindow sendEvent:] + 909
34 UIKit 0x0000000101d4829a -[UIApplication sendEvent:] + 211
35 UIKit 0x0000000101d35aed _UIApplicationHandleEventQueue + 9579
36 CoreFoundation 0x00000001033bad21 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17
37 CoreFoundation 0x00000001033ba5f2 CFRunLoopDoSources0 + 242
38 CoreFoundation 0x00000001033d646f CFRunLoopRun + 767
39 CoreFoundation 0x00000001033d5d83 CFRunLoopRunSpecific + 467
40 GraphicsServices 0x000000010524cf04 GSEventRunModal + 161
41 UIKit 0x0000000101d37e33 UIApplicationMain + 1010
42 Sales Rabbit 0x000000010000c333 main + 115
43 libdyld.dylib 0x0000000103ac35fd start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
As far as I can tell the crash is happening when we call
[curView becomeFirstResponder];
curView is not nil, and is a uitextfield
Any ideas on what to check or help would be greatly appreciated.
So I ended up finding the answer, for some reason someone had written this line of code even though it doesnt seem necessary.
[[UILabel appearance] setShadowColor:[UIColor clearColor]];
And this was causing it to crash, but only in the situation that I described above, not when it was set in the app delegate. It seems like it should be allowed to set a the shadow color to clear, although why you would do this is not apparent to me.

Unrecognized selector sent to instance NSArrayM [closed]

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];

Code no longer working in OS4.3 but fine in 5.0 (used to work fine)

Weird error. My code was written in Xcode 3, and it loaded fine in 4.4 without errors.
Recently, it started not working in OS 4.3 or below, but fine in 5.0 and 5.1. I've done a few weeks of updating my app, so I have no idea where it went out of whack (I was using the current simulator 5.1 when testing, so I didn't even think to try the others after each trial).
Here is my error log, but I can't figure out whats causing the crash. It should note that I get "location services not available" when launching in 4.3 or below, but not in 5.0 and above. It crashes about the time I try to load a view that has a table. Here is my debugger info... any ideas?
> 2012-09-03 05:43:39.582 Diners[7811:12203] [-[MapViewController viewDidLoad] /Users/user/Documents/Source Code/Working Projects/Diners/Classes/MapViewController.m:48]
bootstrap_look_up failed (44e)
2012-09-03 05:43:42.997 Diners[7811:12203] [-[StripClubsAppDelegate i3fSplashViewBrickDidRemoveFromSuperview:] /Users/user/Documents/Source Code/Working Projects/Diners/Classes/StripClubsAppDelegate.m:77]
2012-09-03 05:43:49.883 Diners[7811:12203] -[UITapGestureRecognizer initWithCoder:]: unrecognized selector sent to instance 0x5fe01b0
2012-09-03 05:43:49.950 Diners[7811:12203] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UITapGestureRecognizer initWithCoder:]: unrecognized selector sent to instance 0x5fe01b0'
*** Call stack at first throw:
(
0 CoreFoundation 0x014585a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x01205313 objc_exception_throw + 44
2 CoreFoundation 0x0145a0bb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x013c9966 ___forwarding___ + 966
4 CoreFoundation 0x013c9522 _CF_forwarding_prep_0 + 50
5 UIKit 0x0061c9fd UINibDecoderDecodeObjectForValue + 2592
6 UIKit 0x0061d6ac -[UINibDecoder decodeObjectForKey:] + 398
7 UIKit 0x0053293e -[UIRuntimeConnection initWithCoder:] + 153
8 UIKit 0x00532ee7 -[UIRuntimeEventConnection initWithCoder:] + 64
9 UIKit 0x0061c9fd UINibDecoderDecodeObjectForValue + 2592
10 UIKit 0x0061c2f5 UINibDecoderDecodeObjectForValue + 792
11 UIKit 0x0061d6ac -[UINibDecoder decodeObjectForKey:] + 398
12 UIKit 0x00531c36 -[UINib instantiateWithOwner:options:] + 804
13 UIKit 0x00533ab7 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 168
14 UIKit 0x003e9628 -[UIViewController _loadViewFromNibNamed:bundle:] + 70
15 UIKit 0x003e7134 -[UIViewController loadView] + 120
16 UIKit 0x003e700e -[UIViewController view] + 56
17 UIKit 0x003e5482 -[UIViewController contentScrollView] + 42
18 UIKit 0x003f5f25 -[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:] + 48
19 UIKit 0x003f4555 -[UINavigationController _layoutViewController:] + 43
20 UIKit 0x003f5870 -[UINavigationController _startTransition:fromViewController:toViewController:] + 524
21 UIKit 0x003f032a -[UINavigationController _startDeferredTransitionIfNeeded] + 266
22 UIKit 0x003f7562 -[UINavigationController pushViewController:transition:forceImmediate:] + 932
23 UIKit 0x003f01c4 -[UINavigationController pushViewController:animated:] + 62
24 Diners 0x00002c83 -[MapViewController goToListByState] + 275
25 UIKit 0x003374fd -[UIApplication sendAction:to:from:forEvent:] + 119
26 UIKit 0x003c7799 -[UIControl sendAction:to:forEvent:] + 67
27 UIKit 0x003c9c2b -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
28 UIKit 0x003c8a1c -[UIControl touchesBegan:withEvent:] + 277
29 UIKit 0x0035bd41 -[UIWindow _sendTouchesForEvent:] + 395
30 UIKit 0x0033cc37 -[UIApplication sendEvent:] + 447
31 UIKit 0x00341f2e _UIApplicationHandleEvent + 7576
32 GraphicsServices 0x01a2e992 PurpleEventCallback + 1550
33 CoreFoundation 0x01439944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
34 CoreFoundation 0x01399cf7 __CFRunLoopDoSource1 + 215
35 CoreFoundation 0x01396f83 __CFRunLoopRun + 979
36 CoreFoundation 0x01396840 CFRunLoopRunSpecific + 208
37 CoreFoundation 0x01396761 CFRunLoopRunInMode + 97
38 GraphicsServices 0x01a2d1c4 GSEventRunModal + 217
39 GraphicsServices 0x01a2d289 GSEventRun + 115
40 UIKit 0x00345c93 UIApplicationMain + 1160
41 Diners 0x0000203d main + 125
42 Diners 0x00001fb5 start + 53
)
terminate called throwing an exception(lldb)
It seems that you add a gesture recognizer using interface builder, this feature is only available for ios5 and more.

Resources