The app sometimes crashes with [NSObject(NSObject) doesNotRecognizeSelector:], the selector being [UIImageView setImage:].
I captured it by setting an exception breakpoint and the crash happens when setting an UIImageView.image in prepareForReuse of a UICollectionViewCell:
class MyCell: UICollectionViewCell {
var coverImageView = UIImageView()
...
override func prepareForReuse() {
super.prepareForReuse()
coverImageView.image = nil
}
}
The prepareForReuse is called then the cell is instantiated:
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = myCollectionView.dequeueReusableCell(withReuseIdentifier: "myReuseID", for: indexPath) as! MyCell
...
}
Why is that happening?
Also I cannot load the quick look data view for the UIImageView so maybe the object has been released?
The error messages in console are:
2017-01-21 15:56:19.653 MyApp[4873:20387361] -[__NSMallocBlock__ size]: unrecognized selector sent to instance 0x608000880aa0
2017-01-21 15:56:37.697 MyApp[4873:20387361] invalid mode 'kCFRunLoopCommonModes' provided to CFRunLoopRunSpecific - break on _CFRunLoopError_RunCalledWithInvalidMode to debug. This message will only appear once per execution.
2017-01-21 15:56:38.847 MyApp[4873:20617657] [Optimizely Logging]: Successfully saved data file to disk. Code revision is 229
2017-01-21 15:56:42.723 MyApp[4873:20387361] [Optimizely Logging]: (ERROR) NSInvalidArgumentException: Stack Trace:
(
0 CoreFoundation 0x000000010f587d4b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010ef6121e objc_exception_throw + 48
2 CoreFoundation 0x000000010f5f7f04 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x000000010f50d005 ___forwarding___ + 1013
4 CoreFoundation 0x000000010f50cb88 _CF_forwarding_prep_0 + 120
5 UIKit 0x000000010ba5e20f -[UIImageView _updateImageViewForOldImage:newImage:] + 297
6 UIKit 0x000000010ba59950 -[UIImageView setImage:] + 391
7 MyApp 0x000000010945e0d8 _TFC6MyApp23MyCell15prepareForReusefT_T_ + 136
8 MyApp 0x000000010945e112 _TToFC6MyApp23MyCell15prepareForReusefT_T_ + 34
9 UIKit 0x000000010c19aed1 -[UICollectionView _dequeueReusableViewOfKind:withIdentifier:forIndexPath:viewCategory:] + 773
10 UIKit 0x000000010c19b8ea -[UICollectionView dequeueReusableCellWithReuseIdentifier:forIndexPath:] + 169
11 MyApp 0x00000001095bdee2 _TFC6MyApp23MyViewController14collectionViewfTCSo16UICollectionView13cellForItemAtV10Foundation9IndexPath_CSo20UICollectionViewCell + 594
12 MyApp 0x00000001095be747 _TToFC6MyApp23MyViewController14collectionViewfTCSo16UICollectionView13cellForItemAtV10Foundation9IndexPath_CSo20UICollectionViewCell + 87
13 UIKit 0x000000010c18675f -[UICollectionView _createPreparedCellForItemAtIndexPath:withLayoutAttributes:applyAttributes:isFocused:notify:] + 467
14 UIKit 0x000000010c186586 -[UICollectionView _createPreparedCellForItemAtIndexPath:withLayoutAttributes:applyAttributes:] + 35
15 UIKit 0x000000010c18ba5e -[UICollectionView _updateVisibleCellsNow:] + 4803
16 UIKit 0x000000010c191725 -[UICollectionView layoutSubviews] + 313
17 UIKit 0x000000010b90dab8 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1237
18 QuartzCore 0x000000010d558bf8 -[CALayer layoutSublayers] + 146
19 QuartzCore 0x000000010d54c440 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 366
20 QuartzCore 0x000000010d54c2be _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
21 QuartzCore 0x000000010d4da318 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 280
22 QuartzCore 0x000000010d5073ff _ZN2CA11Transaction6commitEv + 475
23 QuartzCore 0x000000010d507d6f _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 113
24 CoreFoundation 0x000000010f52c267 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
25 CoreFoundation 0x000000010f52c1d7 __CFRunLoopDoObservers + 391
26 CoreFoundation 0x000000010f510f8e __CFRunLoopRun + 1198
27 CoreFoundation 0x000000010f510884 CFRunLoopRunSpecific + 420
28 GraphicsServices 0x0000000112b77a6f GSEventRunModal + 161
29 UIKit 0x000000010b848c68 UIApplicationMain + 159
30 MyApp 0x00000001092f5a7f main + 111
31 libdyld.dylib 0x00000001115b568d start + 1
)
2017-01-21 15:56:42.725 MyApp[4873:20387361] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSMallocBlock__ size]: unrecognized selector sent to instance 0x608000880aa0'
*** First throw call stack:
(
0 CoreFoundation 0x000000010f587d4b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010ef6121e objc_exception_throw + 48
2 CoreFoundation 0x000000010f5f7f04 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x000000010f50d005 ___forwarding___ + 1013
4 CoreFoundation 0x000000010f50cb88 _CF_forwarding_prep_0 + 120
5 UIKit 0x000000010ba5e20f -[UIImageView _updateImageViewForOldImage:newImage:] + 297
6 UIKit 0x000000010ba59950 -[UIImageView setImage:] + 391
7 MyApp 0x000000010945e0d8 _TFC6MyApp23MyCell15prepareForReusefT_T_ + 136
8 MyApp 0x000000010945e112 _TToFC6MyApp23MyCell15prepareForReusefT_T_ + 34
9 UIKit 0x000000010c19aed1 -[UICollectionView _dequeueReusableViewOfKind:withIdentifier:forIndexPath:viewCategory:] + 773
10 UIKit 0x000000010c19b8ea -[UICollectionView dequeueReusableCellWithReuseIdentifier:forIndexPath:] + 169
11 MyApp 0x00000001095bdee2 _TFC6MyApp23MyViewController14collectionViewfTCSo16UICollectionView13cellForItemAtV10Foundation9IndexPath_CSo20UICollectionViewCell + 594
12 MyApp 0x00000001095be747 _TToFC6MyApp23MyViewController14collectionViewfTCSo16UICollectionView13cellForItemAtV10Foundation9IndexPath_CSo20UICollectionViewCell + 87
13 UIKit 0x000000010c18675f -[UICollectionView _createPreparedCellForItemAtIndexPath:withLayoutAttributes:applyAttributes:isFocused:notify:] + 467
14 UIKit 0x000000010c186586 -[UICollectionView _createPreparedCellForItemAtIndexPath:withLayoutAttributes:applyAttributes:] + 35
15 UIKit 0x000000010c18ba5e -[UICollectionView _updateVisibleCellsNow:] + 4803
16 UIKit 0x000000010c191725 -[UICollectionView layoutSubviews] + 313
17 UIKit 0x000000010b90dab8 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1237
18 QuartzCore 0x000000010d558bf8 -[CALayer layoutSublayers] + 146
19 QuartzCore 0x000000010d54c440 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 366
20 QuartzCore 0x000000010d54c2be _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
21 QuartzCore 0x000000010d4da318 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 280
22 QuartzCore 0x000000010d5073ff _ZN2CA11Transaction6commitEv + 475
23 QuartzCore 0x000000010d507d6f _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 113
24 CoreFoundation 0x000000010f52c267 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
25 CoreFoundation 0x000000010f52c1d7 __CFRunLoopDoObservers + 391
26 CoreFoundation 0x000000010f510f8e __CFRunLoopRun + 1198
27 CoreFoundation 0x000000010f510884 CFRunLoopRunSpecific + 420
28 GraphicsServices 0x0000000112b77a6f GSEventRunModal + 161
29 UIKit 0x000000010b848c68 UIApplicationMain + 159
30 MyApp 0x00000001092f5a7f main + 111
31 libdyld.dylib 0x00000001115b568d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
I think the problem is that you are not calling the designated initializer of UIImageView, therefore its image property is not properly initialized and trying to assign to it crashes the app:
-[NSMallocBlock size]: unrecognized selector sent to instance 0x608000880aa0
The method tries to call the size method on the old image but the old image was set to some random memory address.
To fix it, initialize UIImageView properly using the designated initializer:
var coverImageView = UIImageView(image: nil)
Related
I have a Core Data problem - I have two entity's with the second being a one to many relation ship to the first. When trying to load a detailed view controller on the first with the first one's information and a UITableView fo the details of the 2nd, I am hoping this tableView code would allow me to show a blank table if now records are found. Instead I get a crash as indicated above. I have tried to cover the "Event" (the related NSSet) into an array, but I am not sure how to debug this error. Thanks for any pointers!
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "eventCell", for: indexPath)
let eventsOnArray = selectedRecipient?.events.allObjects
let event = eventsOnArray![indexPath.row] as! Event
if selectedRecipient?.events.count != nil {
cell.textLabel?.text = event.event
}
return cell
}
Adding detailed Stack Trace -
2018-03-03 10:27:29.419115-0500 Card Tracker[5162:453078] -[Recipient events]: unrecognized selector sent to instance 0x60000009cbb0
2018-03-03 10:27:29.427781-0500 Card Tracker[5162:453078] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Recipient events]: unrecognized selector sent to instance 0x60000009cbb0'
*** First throw call stack:
(
0 CoreFoundation 0x0000000107fd212b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x0000000103d79f41 objc_exception_throw + 48
2 CoreFoundation 0x0000000108053024 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x0000000107f54f78 ___forwarding___ + 1432
4 CoreFoundation 0x0000000107f54958 _CF_forwarding_prep_0 + 120
5 Card Tracker 0x0000000103434fca _T012Card_Tracker010ViewEventsC10ControllerC05tableC0SiSo07UITableC0C_Si21numberOfRowsInSectiontF + 410
6 Card Tracker 0x00000001034352e4 _T012Card_Tracker010ViewEventsC10ControllerC05tableC0SiSo07UITableC0C_Si21numberOfRowsInSectiontFTo + 68
7 UIKit 0x0000000104cd1b4c -[UITableView _numberOfRowsInSection:] + 62
8 UIKit 0x0000000104f840e1 -[UISectionRowData refreshWithSection:tableView:tableViewRowData:] + 2389
9 UIKit 0x0000000104f8a5ab -[UITableViewRowData rectForFooterInSection:heightCanBeGuessed:] + 487
10 UIKit 0x0000000104f8a711 -[UITableViewRowData heightForTable] + 61
11 UIKit 0x0000000104c7fa65 -[UITableView _updateContentSize] + 372
12 UIKit 0x0000000104cb067d -[UITableView _rebuildGeometry] + 66
13 UIKit 0x0000000104cae03c -[UITableView didMoveToWindow] + 145
14 UIKit 0x0000000104c2b147 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 1748
15 UIKit 0x0000000104c44a81 -[UIScrollView _didMoveFromWindow:toWindow:] + 84
16 UIKit 0x0000000104c2ad84 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 785
17 UIKit 0x0000000104c1d1e1 __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 151
18 UIKit 0x0000000104c1d0c8 -[UIView(Hierarchy) _postMovedFromSuperview:] + 828
19 UIKit 0x0000000104c2dcbd -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1973
20 UIKit 0x0000000104b504e7 -[_UIParallaxDimmingView didMoveToWindow] + 179
21 UIKit 0x0000000104c2b147 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 1748
22 UIKit 0x0000000104c2ad84 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 785
23 UIKit 0x0000000104c1d1e1 __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 151
24 UIKit 0x0000000104c1d0c8 -[UIView(Hierarchy) _postMovedFromSuperview:] + 828
25 UIKit 0x0000000104c2dcbd -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1973
26 UIKit 0x0000000104b4b259 __53-[_UINavigationParallaxTransition animateTransition:]_block_invoke_2 + 2305
27 UIKit 0x0000000104c25c60 +[UIView(Animation) performWithoutAnimation:] + 90
28 UIKit 0x0000000104b4a903 __53-[_UINavigationParallaxTransition animateTransition:]_block_invoke + 260
29 UIKit 0x0000000104c2c271 +[UIView(Internal) _performBlockDelayingTriggeringResponderEvents:] + 188
30 UIKit 0x0000000104b4a21b -[_UINavigationParallaxTransition animateTransition:] + 1270
31 UIKit 0x0000000104d3e3ee -[UINavigationController _startCustomTransition:] + 3678
32 UIKit 0x0000000104d543b4 -[UINavigationController _startDeferredTransitionIfNeeded:] + 686
33 UIKit 0x0000000104d556d3 -[UINavigationController __viewWillLayoutSubviews] + 150
34 UIKit 0x0000000104fb04e2 -[UILayoutContainerView layoutSubviews] + 231
35 UIKit 0x0000000121187008 -[UILayoutContainerViewAccessibility layoutSubviews] + 42
36 UIKit 0x0000000104c34a6d -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1439
37 QuartzCore 0x000000010b5d361c -[CALayer layoutSublayers] + 159
38 QuartzCore 0x000000010b5d77ad _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 401
39 QuartzCore 0x000000010b55e86c _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 364
40 QuartzCore 0x000000010b58b946 _ZN2CA11Transaction6commitEv + 500
41 UIKit 0x0000000104b8d167 _afterCACommitHandler + 272
42 CoreFoundation 0x0000000107f74c07 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
43 CoreFoundation 0x0000000107f74b5e __CFRunLoopDoObservers + 430
44 CoreFoundation 0x0000000107f59124 __CFRunLoopRun + 1572
45 CoreFoundation 0x0000000107f58889 CFRunLoopRunSpecific + 409
46 GraphicsServices 0x000000010a77b9c6 GSEventRunModal + 62
47 UIKit 0x0000000104b635d6 UIApplicationMain + 159
48 Card Tracker 0x0000000103417ea7 main + 55
49 libdyld.dylib 0x0000000109170d81 start + 1
50 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Two problems uncovered. one in the data model the secondary entity is called card not events. And two as pointed out by #vadian above should do the load in the viewDidLoad. Thanks
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))
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.
I have integrated AdMob into My Application. Now when i am pushing to the AdMob view it constantly gets crashed.
Here is the Crash log :
2014-04-03 17:56:40.134 myApp[2934:a0b] -[GADSlot state]: unrecognized selector sent to instance 0x1133f700
2014-04-03 17:56:44.047 myApp[2934:a0b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[GADSlot state]: unrecognized selector sent to instance 0x1133f700'
*** First throw call stack:
(
0 CoreFoundation 0x050955e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x028998b6 objc_exception_throw + 44
2 CoreFoundation 0x05132903 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
3 CoreFoundation 0x0508590b ___forwarding___ + 1019
4 CoreFoundation 0x050854ee _CF_forwarding_prep_0 + 14
5 myApp 0x0004a2ce -[GADSlot isMakingRequest] + 36
6 myApp 0x00049f2d -[GADSlot setAdType:andReloadRequest:] + 334
7 myApp 0x00048d0e -[GADBannerView setAdSize:andReload:] + 512
8 myApp 0x00049302 -[GADBannerView setAdSize:] + 62
9 myApp 0x0004957c -[GADBannerView initWithFrame:] + 172
10 myApp 0x00008822 -[JustStartVC viewDidLoad] + 18242
11 UIKit 0x015129a8 -[UIViewController loadViewIfRequired] + 696
12 UIKit 0x01512c44 -[UIViewController view] + 35
13 UIKit 0x0152ca72 -[UINavigationController _startCustomTransition:] + 778
14 UIKit 0x01539757 -[UINavigationController _startDeferredTransitionIfNeeded:] + 688
15 UIKit 0x0153a349 -[UINavigationController __viewWillLayoutSubviews] + 57
16 UIKit 0x0167339d -[UILayoutContainerView layoutSubviews] + 213
17 UIKit 0x01469dd7 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 355
18 libobjc.A.dylib 0x028ab81f -[NSObject performSelector:withObject:] + 70
19 QuartzCore 0x012d972a -[CALayer layoutSublayers] + 148
20 QuartzCore 0x012cd514 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380
21 QuartzCore 0x012cd380 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 26
22 QuartzCore 0x01235156 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 294
23 QuartzCore 0x012364e1 _ZN2CA11Transaction6commitEv + 393
24 QuartzCore 0x01236bb4 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 92
25 CoreFoundation 0x0505d53e __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
26 CoreFoundation 0x0505d48f __CFRunLoopDoObservers + 399
27 CoreFoundation 0x0503b3b4 __CFRunLoopRun + 1076
28 CoreFoundation 0x0503ab33 CFRunLoopRunSpecific + 467
29 CoreFoundation 0x0503a94b CFRunLoopRunInMode + 123
30 GraphicsServices 0x02a999d7 GSEventRunModal + 192
31 GraphicsServices 0x02a997fe GSEventRun + 104
32 UIKit 0x013ff94b UIApplicationMain + 1225
33 myApp 0x00016b2d main + 141
34 libdyld.dylib 0x056b9725 start + 0
35 ??? 0x00000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Thanks.
Go to project settings > Build Settings And set -ObjC to Other Linker Flags.
More info: https://stackoverflow.com/a/22585112/2115477
I referred few discussions & found that there is an flag need to be added in build settings.
Here it is :
Targets -> Build Settings -> Linking -> Other Linker Flags
I set here -ObjC
So now its working.
I am getting an error while running app with following exception.
Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<FavoriteViewController 0x158d30> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key customCell.'
*** Call stack at first throw:
(
0 CoreFoundation 0x314d0987 __exceptionPreprocess + 114
1 libobjc.A.dylib 0x319a149d objc_exception_throw + 24
2 CoreFoundation 0x314d0705 -[NSException dealloc] + 0
3 Foundation 0x31d28b4f -[NSObject(NSKeyValueCoding) setValue:forUndefinedKey:] + 182
4 Foundation 0x31d2803b _NSSetUsingKeyValueSetter + 90
5 Foundation 0x31d29da3 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 194
6 Foundation 0x31cdbb17 -[NSObject(NSKeyValueCoding) setValue:forKeyPath:] + 130
7 UIKit 0x33a8860f -[UIRuntimeOutletConnection connect] + 66
8 CoreFoundation 0x31473fc7 -[NSObject(NSObject) performSelector:] + 18
9 CoreFoundation 0x3147cd51 -[NSArray makeObjectsPerformSelector:] + 388
10 UIKit 0x33a87577 -[UINib instantiateWithOwner:options:] + 586
11 UIKit 0x33a88b39 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 92
12 Fridge 0x0001ab11 -[FavoriteViewController tableView:cellForRowAtIndexPath:] + 192
13 UIKit 0x33907a21 -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:withIndexPath:] + 516
14 UIKit 0x339077f3 -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:] + 34
15 UIKit 0x33905d2d -[UITableView(_UITableViewPrivate) _updateVisibleCellsNow:] + 936
16 UIKit 0x33904edd -[UITableView layoutSubviews] + 140
17 UIKit 0x338b10cf -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 26
18 CoreFoundation 0x3146ebbf -[NSObject(NSObject) performSelector:withObject:] + 22
19 QuartzCore 0x30a6c685 -[CALayer layoutSublayers] + 120
20 QuartzCore 0x30a6c43d CALayerLayoutIfNeeded + 184
21 QuartzCore 0x30a6656d _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 212
22 QuartzCore 0x30a66383 _ZN2CA11Transaction6commitEv + 190
23 QuartzCore 0x30a89f9d _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 52
24 CoreFoundation 0x31460c59 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 16
25 CoreFoundation 0x31460acd __CFRunLoopDoObservers + 412
26 CoreFoundation 0x314580cb __CFRunLoopRun + 854
27 CoreFoundation 0x31457c87 CFRunLoopRunSpecific + 230
28 CoreFoundation 0x31457b8f CFRunLoopRunInMode + 58
29 GraphicsServices 0x35d664ab GSEventRunModal + 114
30 GraphicsServices 0x35d66557 GSEventRun + 62
31 UIKit 0x338d5329 -[UIApplication _run] + 412
32 UIKit 0x338d2e93 UIApplicationMain + 670
33 Fridge 0x00002d77 main + 70
34 Fridge 0x00002d2c start + 40
)
The error message: Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key customCell.'
... means that your xib is referencing an IBOutlet named "customCell" but your view controller doesn't have that IBOutlet anymore. You either need to remove the customCell reference from your xib or add an IBOutlet property to your view controller named "customCell".