Swift : Terminating app with uncaught exception of NSExeption? - swift

Before you say "this is a repeat of a question", no. I have checked the question before and all it tells me is to check my outlets. All my outlets are correct and I'm not sure why I'm getting this error. Here's the error in detail :
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSTaggedPointerString objectForKeyedSubscript:]: unrecognized selector sent to instance 0xa00000000006e652'
*** First throw call stack:
(
0 CoreFoundation 0x000000010ddf5d4b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010d85e21e objc_exception_throw + 48
2 CoreFoundation 0x000000010de65f04 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x000000010dd7b005 ___forwarding___ + 1013
4 CoreFoundation 0x000000010dd7ab88 _CF_forwarding_prep_0 + 120
5 Calc 0x0000000108d00b37 -[MPCoreInstanceProvider appTransportSecuritySettings] + 284
6 Calc 0x0000000108cc4147 +[MPAdServerURLBuilder queryParameterForAppTransportSecurity] + 76
7 Calc 0x0000000108cc30d4 +[MPAdServerURLBuilder URLWithAdUnitID:keywords:location:versionParameterName:version:testing:desiredAssets:adSequence:] + 1674
8 Calc 0x0000000108cc2a01 +[MPAdServerURLBuilder URLWithAdUnitID:keywords:location:versionParameterName:version:testing:desiredAssets:] + 173
9 Calc 0x0000000108cc2920 +[MPAdServerURLBuilder URLWithAdUnitID:keywords:location:testing:] + 116
10 Calc 0x0000000108cd3cde -[MPBannerAdManager loadAdWithURL:] + 470
11 Calc 0x0000000108cc03a2 -[MPAdView loadAd] + 48
12 Calc 0x000000010895aa1f _TFFC4Calc18MenuViewController11viewDidLoadFT_T_L_7loadAdsfT_T_ + 175
13 Calc 0x0000000108957d18 _TFC4Calc18MenuViewController11viewDidLoadfT_T_ + 8104
14 Calc 0x000000010895b632 _TToFC4Calc18MenuViewController11viewDidLoadfT_T_ + 34
15 UIKit 0x00000001099cb8b1 -[UIViewController loadViewIfRequired] + 1258
16 UIKit 0x00000001099cbce4 -[UIViewController view] + 27
17 UIKit 0x0000000109895405 -[UIWindow addRootViewControllerViewIfPossible] + 71
18 UIKit 0x0000000109895b56 -[UIWindow _setHidden:forced:] + 293
19 UIKit 0x00000001098a9469 -[UIWindow makeKeyAndVisible] + 42
20 Calc 0x0000000108c32264 _TFC4Calc11AppDelegate11applicationfTCSo13UIApplication29didFinishLaunchingWithOptionsGSqGVs10DictionaryVSC29UIApplicationLaunchOptionsKeyP____Sb + 5716
21 Calc 0x0000000108c34674 _TToFC4Calc11AppDelegate11applicationfTCSo13UIApplication29didFinishLaunchingWithOptionsGSqGVs10DictionaryVSC29UIApplicationLaunchOptionsKeyP____Sb + 180
22 UIKit 0x0000000109820312 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 290
23 UIKit 0x0000000109821c97 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4236
24 UIKit 0x000000010982803d -[UIApplication _runWithMainScene:transitionContext:completion:] + 1731
25 UIKit 0x00000001098251bd -[UIApplication workspaceDidEndTransaction:] + 188
26 FrontBoardServices 0x00000001160176cb __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24
27 FrontBoardServices 0x0000000116017544 -[FBSSerialQueue _performNext] + 189
28 FrontBoardServices 0x00000001160178cd -[FBSSerialQueue _performNextFromRunLoopSource] + 45
29 CoreFoundation 0x000000010dd9a761 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
30 CoreFoundation 0x000000010dd7f98c __CFRunLoopDoSources0 + 556
31 CoreFoundation 0x000000010dd7ee76 __CFRunLoopRun + 918
32 CoreFoundation 0x000000010dd7e884 CFRunLoopRunSpecific + 420
33 UIKit 0x0000000109823a3a -[UIApplication _run] + 434
34 UIKit 0x0000000109829bb8 UIApplicationMain + 159
35 Calc 0x0000000108c4617f main + 111
36 libdyld.dylib 0x0000000110df668d start + 1
37 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)

Looks like the Info.plist of your app may not have a proper values for NSAppTransportSecurity or one of its children.
Check out: MPCoreInstanceProvider.m.
"this is a repeat of a question" - next time look at your stack trace, it contains all the hints required:
Close to the top you have the -[NSObject(NSObject) doesNotRecognizeSelector:] which is throwing the exception (objc_exception_throw ...)
doesNotRecognizeSelector means that some code tried to invoke a method which is not available
which one? Look further above: -[NSTaggedPointerString objectForKeyedSubscript:]
so the method missing is objectForKeyedSubscript: which is what the Objective-C compiler generates for an expression like: myObject[#"title"]
it also tells you the class of the object the method is invoked on: NSTaggedPointerString, so some code tried to use [] on a plain string, which doesn't make much sense
Next thing to check is who invoked that code: -[MPCoreInstanceProvider appTransportSecuritySettings] is the last regular code in the stack
so you DuckDuckGo MPCoreInstanceProvider and find MPCoreInstanceProvider.m
which happens to have a appTransportSecuritySettings method
looking into the code it grabs a dictionary NSDictionary *atsSettingsDictionary = [NSBundle mainBundle].infoDictionary[kMoPubAppTransportSecurityDictionaryKey];
and then does a lot of [] operations on that dictionary and values of it
Conclusion: One of the [] is hitting a string when it was expecting a dictionary.

Related

Calling #selector #objc function through perform crasher

I am calling a function through another view controller with:
perform(#selector(MainScreenViewController().test))
The action is called test and it is located in the MainScreenViewController().
Once it reaches this code the application crashes with the following crash report:
2018-01-20 13:24:46.800692+0100 Business Name[40750:3947268] -[Business_Name.RPLabel test]: unrecognized selector sent to instance 0x7fd444d03e30
2018-01-20 13:24:46.809915+0100 Business Name[40750:3947268] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Business_Name.RPLabel test]: unrecognized selector sent to instance 0x7fd444d03e30'
*** First throw call stack:
(
0 CoreFoundation 0x00000001127621cb __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010de9af41 objc_exception_throw + 48
2 CoreFoundation 0x00000001127e2914 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 UIKit 0x000000010f5810bd -[UIResponder doesNotRecognizeSelector:] + 295
4 CoreFoundation 0x00000001126e5178 ___forwarding___ + 1432
5 CoreFoundation 0x00000001126e4b58 _CF_forwarding_prep_0 + 120
6 Business Name 0x000000010d54edc2 _T013Business_Name7RPLabelC5setupyyF + 738
7 Business Name 0x000000010d54e705 _T013Business_Name7RPLabelCACSC6CGRectV5frame_tcfc + 325
8 Business Name 0x000000010d54e746 _T013Business_Name7RPLabelCACSC6CGRectV5frame_tcfcTo + 38
9 UIKit 0x000000010f3f3f66 -[UIView init] + 62
10 Business Name 0x000000010d5385a3 _T0So7UILabelCABycfcTO + 19
11 Business Name 0x000000010d53137c _T0So7UILabelCABycfC + 60
12 Business Name 0x000000010d538944 globalinit_33_2857E66F75A5DBE934F5CCD1167A060E_func5 + 20
13 libdispatch.dylib 0x000000011380f43c _dispatch_client_callout + 8
14 libdispatch.dylib 0x00000001138109c7 dispatch_once_f + 297
15 Business Name 0x000000010d538984 _T013Business_Name9mainTitleAA7RPLabelCfau + 36
16 Business Name 0x000000010d5389ae _T013Business_Name10setupTitleyyF + 30
17 Business Name 0x000000010d53fd1f _T013Business_Name24MainScreenViewControllerC13viewDidAppearySbF + 31
18 Business Name 0x000000010d53fe23 _T013Business_Name24MainScreenViewControllerC13viewDidAppearySbFTo + 51
19 UIKit 0x000000010f4fcaaf -[UIViewController _setViewAppearState:isAnimating:] + 699
20 UIKit 0x000000010f55b746 -[UITabBarController viewDidAppear:] + 115
21 UIKit 0x000000010f4fcaaf -[UIViewController _setViewAppearState:isAnimating:] + 699
22 UIKit 0x000000010f4ff959 __64-[UIViewController viewDidMoveToWindow:shouldAppearOrDisappear:]_block_invoke + 42
23 UIKit 0x000000010f4fdc4d -[UIViewController _executeAfterAppearanceBlock] + 86
24 UIKit 0x000000010f364d9d _runAfterCACommitDeferredBlocks + 634
25 UIKit 0x000000010f35330d _cleanUpAfterCAFlushAndRunDeferredBlocks + 280
26 UIKit 0x000000010f374714 __34-[UIApplication _firstCommitBlock]_block_invoke_2 + 155
27 CoreFoundation 0x000000011270520c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
28 CoreFoundation 0x00000001126e9a3b __CFRunLoopDoBlocks + 203
29 CoreFoundation 0x00000001126e9214 __CFRunLoopRun + 1300
30 CoreFoundation 0x00000001126e8a89 CFRunLoopRunSpecific + 409
31 GraphicsServices 0x000000011556e9c6 GSEventRunModal + 62
32 UIKit 0x000000010f358d30 UIApplicationMain + 159
33 Business Name 0x000000010d548637 main + 55
34 libdyld.dylib 0x000000011388bd81 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
This is the code in test:
#objc func test(){
print("test")
}
MainScreenViewController().perform(#selector(MainScreenViewController().test))

What does this error (NSInvalidArgumentException) mean?

Got this error for a Tetris game that I'm making. Not really sure how to upload the Xcode project to GitHub as I get denied as I don't have access so sorry for no context. None of this error seems to actually make sense to me, its just a random collection of numbers and some recognisable phrases like 'SpriteKit' or 'UIKit'.
2017-05-15 10:09:10.942 Tetris[2258:77198] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Setting this node as parent would create a loop: <SKNode> name:'(null)' position:{6, -6} scale:{1.00, 1.00} accumulatedFrame:{{12, -412}, {200, 400}}'
*** First throw call stack:
(
0 CoreFoundation 0x000000010fa4dd4b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010cacb21e objc_exception_throw + 48
2 CoreFoundation 0x000000010fab72b5 +[NSException raise:format:] + 197
3 SpriteKit 0x000000010cfe3134 -[SKNode(setParent) setParent:] + 87
4 SpriteKit 0x000000010cfdc376 -[SKNode insertChild:atIndex:] + 230
5 SpriteKit 0x000000010cfdc26f -[SKNode addChild:] + 68
6 Tetris 0x000000010c4bafe0 _TFC6Tetris9GameScenecfT4sizeVSC6CGSize_S0_ + 1376
7 Tetris 0x000000010c4bb080 _TFC6Tetris9GameSceneCfT4sizeVSC6CGSize_S0_ + 64
8 Tetris 0x000000010c4c23f2 _TFC6Tetris18GameViewController11viewDidLoadfT_T_ + 274
9 Tetris 0x000000010c4c3222 _TToFC6Tetris18GameViewController11viewDidLoadfT_T_ + 34
10 UIKit 0x000000010d368a3d -[UIViewController loadViewIfRequired] + 1258
11 UIKit 0x000000010d368e70 -[UIViewController view] + 27
12 UIKit 0x000000010d2324b5 -[UIWindow addRootViewControllerViewIfPossible] + 71
13 UIKit 0x000000010d232c06 -[UIWindow _setHidden:forced:] + 293
14 UIKit 0x000000010d246519 -[UIWindow makeKeyAndVisible] + 42
15 UIKit 0x000000010d1bef8d -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4818
16 UIKit 0x000000010d1c50ed -[UIApplication _runWithMainScene:transitionContext:completion:] + 1731
17 UIKit 0x000000010d1c226d -[UIApplication workspaceDidEndTransaction:] + 188
18 FrontBoardServices 0x0000000116a4b6cb __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24
19 FrontBoardServices 0x0000000116a4b544 -[FBSSerialQueue _performNext] + 189
20 FrontBoardServices 0x0000000116a4b8cd -[FBSSerialQueue _performNextFromRunLoopSource] + 45
21 CoreFoundation 0x000000010f9f2761 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
22 CoreFoundation 0x000000010f9d798c __CFRunLoopDoSources0 + 556
23 CoreFoundation 0x000000010f9d6e76 __CFRunLoopRun + 918
24 CoreFoundation 0x000000010f9d6884 CFRunLoopRunSpecific + 420
25 UIKit 0x000000010d1c0aea -[UIApplication _run] + 434
26 UIKit 0x000000010d1c6c68 UIApplicationMain + 159
27 Tetris 0x000000010c4c858f main + 111
28 libdyld.dylib 0x00000001109fd68d start + 1
29 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
Adapted from the Official Documentation, NSInvalidArgumentException is:
Name of an exception that occurs when you pass an invalid argument to
a method, such as a nil pointer where a non-nil object is required.
It should also has a reason of why it occurred.
Referring to your case the reason is:
Setting this node as parent would create a loop:
name:'(null)' position:{6, -6} scale:{1.00, 1.00}
accumulatedFrame:{{12, -412}, {200, 400}}
Trying to debug the crashed scene, the reason should be clear enough for detecting what is the reason of causing the crash.

SIGABRT Error swift

Could anyone help me understand why Im getting this error? It seems to be happening when I load one of my view controllers but I can't see why.
What usually causes an error like this?
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UITextInputTraits length]: unrecognized selector sent to instance 0x7fbf924828a0'
*** First throw call stack:
(
0 CoreFoundation 0x000000010664ac65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000105f27bb7 objc_exception_throw + 45
2 CoreFoundation 0x00000001066520ad -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x00000001065a813c ___forwarding___ + 988
4 CoreFoundation 0x00000001065a7cd8 _CF_forwarding_prep_0 + 120
5 libswiftCore.dylib 0x0000000107ddf728 _TTSf4g_d___TFSSCfMSSFT12_cocoaStringPSs9AnyObject__SS + 120
6 libswiftCore.dylib 0x0000000107dc01a3 _TFSSCfMSSFT12_cocoaStringPSs9AnyObject__SS + 19
7 Project1 0x00000001054ec3bd _TToFC8ASA_Rank22SettingsViewControllers9ASANumberSS + 61
8 Foundation 0x0000000105abdb53 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 259
9 CoreFoundation 0x0000000106592d50 -[NSArray makeObjectsPerformSelector:] + 224
10 UIKit 0x0000000106d1b4eb -[UINib instantiateWithOwner:options:] + 1506
11 UIKit 0x0000000106b736d8 -[UIViewController _loadViewFromNibNamed:bundle:] + 242
12 UIKit 0x0000000106b73cc8 -[UIViewController loadView] + 109
13 UIKit 0x0000000106b73f39 -[UIViewController loadViewIfRequired] + 75
14 UIKit 0x0000000106b743ce -[UIViewController view] + 27
15 UIKit 0x000000010710132d -[_UIFullscreenPresentationController _setPresentedViewController:] + 65
16 UIKit 0x0000000106b4ed69 -[UIPresentationController initWithPresentedViewController:presentingViewController:] + 105
17 UIKit 0x0000000106b80248 -[UIViewController _presentViewController:withAnimationController:completion:] + 1761
18 UIKit 0x0000000106b826c1 __62-[UIViewController presentViewController:animated:completion:]_block_invoke + 132
19 UIKit 0x0000000106b825e5 -[UIViewController presentViewController:animated:completion:] + 229
20 UIKit 0x0000000106a44d62 -[UIApplication sendAction:to:from:forEvent:] + 75
21 UIKit 0x0000000106b5650a -[UIControl _sendActionsForEvents:withEvent:] + 467
22 UIKit 0x0000000106b558d9 -[UIControl touchesEnded:withEvent:] + 522
23 UIKit 0x0000000106a91958 -[UIWindow _sendTouchesForEvent:] + 735
24 UIKit 0x0000000106a92282 -[UIWindow sendEvent:] + 682
25 UIKit 0x0000000106a58541 -[UIApplication sendEvent:] + 246
26 UIKit 0x0000000106a65cdc _UIApplicationHandleEventFromQueueEvent + 18265
27 UIKit 0x0000000106a4059c _UIApplicationHandleEventQueue + 2066
28 CoreFoundation 0x000000010657e431 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
29 CoreFoundation 0x00000001065742fd __CFRunLoopDoSources0 + 269
30 CoreFoundation 0x0000000106573934 __CFRunLoopRun + 868
31 CoreFoundation 0x0000000106573366 CFRunLoopRunSpecific + 470
32 GraphicsServices 0x000000010a1e0a3e GSEventRunModal + 161
33 UIKit 0x0000000106a438c0 UIApplicationMain + 1282
34 Project1 0x00000001054f70c7 main + 135
35 libdyld.dylib 0x0000000108530145 start + 1
36 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Please ask for any other informations that is helpful
Thanks
You most likely have an Outlet assigned to an element on the view controller you are transitioning to that is no longer connected to your code. This youtube video explains it in more detail.
To hunt down this issue, try right-clicking on all your elements (UILabels, UIViews, UIButton...) with the assistant editor open and cross check to see if the outlet name is referenced in the view controller.

Assertion Failure

I am developing an iPad application with SDK4.2. I have a very strange error when touching any textField in my application. The first time I touch, the keyboard is shown, but when a second touch is done in the object I obtain following trace.
And it occurs also in any TextField shown in a HTML page with a UIWebView object.
Any ideas?
I am really confused with this.. Thanks in advance!
2010-12-17 11:53:11.697 BancoPopular[48914:207] *** Assertion failure in -[UIButtonLabel setTextColor:], /SourceCache/UIKit_Sim/UIKit-1447.6.4/UILabel.m:314
2010-12-17 11:53:11.699 BancoPopular[48914:207] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: color'
*** Call stack at first throw:
(
0 CoreFoundation 0x01730be9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x018855c2 objc_exception_throw + 47
2 CoreFoundation 0x016e9628 +[NSException raise:format:arguments:] + 136
3 Foundation 0x0013947b -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 116
4 UIKit 0x0045d1dc -[UILabel setTextColor:] + 164
5 UIKit 0x0052177b -[UIButton layoutSubviews] + 1337
6 UIKit 0x005f3420 -[UICalloutBarButton layoutSubviews] + 54
7 QuartzCore 0x011a4451 -[CALayer layoutSublayers] + 181
8 QuartzCore 0x011a417c CALayerLayoutIfNeeded + 220
9 QuartzCore 0x011a4088 -[CALayer layoutIfNeeded] + 111
10 UIKit 0x0051f2ff -[UIButton titleLabel] + 81
11 UIKit 0x005f81d1 -[UICalloutBarButton setContentScale:] + 141
12 UIKit 0x005f6c5d -[UICalloutBar _updateVisibleItems] + 2240
13 UIKit 0x005f2970 -[UICalloutBar appear] + 211
14 UIKit 0x005eaaa9 -[UITextSelectionView showCommandsWithReplacements:] + 291
15 Foundation 0x000bd7f6 __NSFireDelayedPerform + 441
16 CoreFoundation 0x01711fe3 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 19
17 CoreFoundation 0x01713594 __CFRunLoopDoTimer + 1220
18 CoreFoundation 0x0166fcc9 __CFRunLoopRun + 1817
19 CoreFoundation 0x0166f240 CFRunLoopRunSpecific + 208
20 CoreFoundation 0x0166f161 CFRunLoopRunInMode + 97
21 GraphicsServices 0x01e25268 GSEventRunModal + 217
22 GraphicsServices 0x01e2532d GSEventRun + 115
23 UIKit 0x0034d42e UIApplicationMain + 1160
24 BancoPopular 0x0000292e main + 84
25 BancoPopular 0x000028d1 start + 53
26 ??? 0x00000001 0x0 + 1
)
terminate called after throwing an instance of 'NSException'
Look carefully what exception was about. It said "reason: 'Invalid parameter not satisfying: color'", somewhere in your code, you provide wrong parameter that is supposed to be valid colors. Apparently, it seems like you use UIButton with label and set its color but not valid.
My guess is that you have some object going away somewhere, and that object contains the "color" value.
Most likely you received an autoreleased value from some call and did not retain it, so it went "poof" when the UI came up for air.

unrecognized selector sent to instance. Method being called for random objects

Ok, so this has me completely stumped just like the guy here with the exact problem.
I have a UITableView with some rows in a view controller which supports autorotation and sometimes, if i rotate the phone, i get "EXC_BAD_ACCESS" and sometimes i get SIGABRT with a stack trace like:
2010-11-19 16:51:05.634 [2306:307] -[CABasicAnimation numberOfSectionsInTableView:]: unrecognized selector sent to instance 0x58207d0
2010-11-19 16:51:05.688 [2306:307] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CABasicAnimation numberOfSectionsInTableView:]: unrecognized selector sent to instance 0x58207d0'
*** Call stack at first throw:
(
0 CoreFoundation 0x344aaed3 __exceptionPreprocess + 114
1 libobjc.A.dylib 0x33975811 objc_exception_throw + 24
2 CoreFoundation 0x344ac683 -[NSObject(NSObject) doesNotRecognizeSelector:] + 102
3 CoreFoundation 0x344541d9 ___forwarding___ + 508
4 CoreFoundation 0x34453f90 _CF_forwarding_prep_0 + 48
5 UIKit 0x31b20717 -[UITableViewRowData(UITableViewRowDataPrivate) _updateNumSections] + 66
6 UIKit 0x31b20677 -[UITableViewRowData invalidateAllSections] + 50
7 UIKit 0x31b2048d -[UITableView(_UITableViewPrivate) _updateRowData] + 64
8 UIKit 0x31b22941 -[UITableView(_UITableViewPrivate) _ensureRowDataIsLoaded] + 24
9 UIKit 0x31b22909 -[UITableView numberOfSections] + 16
10 UIKit 0x31bd114f -[UISearchDisplayController _updateNoSearchResultsMessageVisiblity] + 54
11 UIKit 0x31cfbef7 -[UISearchDisplayController windowWillAnimateRotation:] + 478
12 Foundation 0x3325d6b3 _nsnote_callback + 142
13 CoreFoundation 0x34431713 __CFXNotificationPost_old + 402
14 CoreFoundation 0x344313b3 _CFXNotificationPostNotification + 118
15 Foundation 0x3324cdb7 -[NSNotificationCenter postNotificationName:object:userInfo:] + 70
16 UIKit 0x31b5dbb7 -[UIWindow _setRotatableClient:toOrientation:duration:force:] + 3114
17 UIKit 0x31b64013 -[UIWindow _setRotatableViewOrientation:duration:force:] + 50
18 UIKit 0x31b39a0f -[UIWindow _updateToInterfaceOrientation:duration:force:] + 74
19 UIKit 0x31b39be9 -[UIWindow _updateInterfaceOrientationFromDeviceOrientation:] + 112
20 UIKit 0x31b39b15 -[UIWindow _handleDeviceOrientationChange:] + 88
21 Foundation 0x3325d6b3 _nsnote_callback + 142
22 CoreFoundation 0x34431713 __CFXNotificationPost_old + 402
23 CoreFoundation 0x344313b3 _CFXNotificationPostNotification + 118
24 Foundation 0x3324cdb7 -[NSNotificationCenter postNotificationName:object:userInfo:] + 70
25 UIKit 0x31b0d0ed -[UIDevice setOrientation:animated:] + 144
26 UIKit 0x31b2a51b -[UIApplication handleEvent:withNewEvent:] + 2738
27 UIKit 0x31b29901 -[UIApplication sendEvent:] + 44
28 UIKit 0x31b29337 _UIApplicationHandleEvent + 5110
29 GraphicsServices 0x3026c04b PurpleEventCallback + 666
30 CoreFoundation 0x3443fce3 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 26
31 CoreFoundation 0x3443fca7 __CFRunLoopDoSource1 + 166
32 CoreFoundation 0x3443256d __CFRunLoopRun + 520
33 CoreFoundation 0x34432277 CFRunLoopRunSpecific + 230
34 CoreFoundation 0x3443217f CFRunLoopRunInMode + 58
35 GraphicsServices 0x3026b5f3 GSEventRunModal + 114
36 GraphicsServices 0x3026b69f GSEventRun + 62
37 UIKit 0x31ad0123 -[UIApplication _run] + 402
38 UIKit 0x31ace12f UIApplicationMain + 670
39 App 0x0000285f main + 70
40 App 0x00002814 start + 40
)
terminate called after throwing an instance of 'NSException'
Program received signal: “SIGABRT”.
In this case it is CABasicAnimation on which numberOfSectionsInTableView is being called but sometimes there are class names like NSMachPort which i have never heard of. Also, the method being called numberOfSectionsInTableView remains the same with the class names changing to always give a doesNotRecognizeSelector exception.
Also this problem only happens when i try to rotate the device. Whenever i get a stack trace like above, there are all system functions which makes it difficult to debug.
Really need some expert advice on this. Please read the forum mentioned above to be clear about the issue.
Whoa! I thought i knew NSZombies enough but i was wrong!
I enabled NSZombies which led me to:
*** -[ContactsViewController numberOfSectionsInTableView:]: message sent to deallocated instance 0x88dafa0
Doing "po 0x88dafa0" wont work because that object's memory was already freed.
Some more Googling led me to this where the author describes how to find freed/deallocated objects. We just have to set MallocStackLoggingNoCompact to 1 in the Variables to be set in the environment along with NSZombieEnabled.
The output i got with the info malloc-history 0xf270740 command had a line:
-[VoicePlayController actionSheet:clickedButtonAtIndex:] at /Users/Documents/Xcode Projects/Classes/VoicePlayController.m:454
The code on that line is:
contactsViewController = [[ContactsViewController alloc] initWithNibName:#"ContactsViewController" bundle:nil];
I moved the [contactsViewController release]; line to dealloc method instead of immediately after [self.navigationController presentModalViewController:contactsViewController animated:YES]; and the problem is gone!
Start with enabling NSZombies. What it sounds like is you are over-releasing an object.