I got crash issue from Crashlytics.
UIKit
-[UIView(Internal) _addSubview:positioned:relativeTo:]
Fatal Exception: NSInvalidArgumentException NSInvalidArgumentException
Can't add self as subview
Thread : Fatal Exception: NSInvalidArgumentException
0 CoreFoundation 0x2e9a0f4b __exceptionPreprocess + 130
1 libobjc.A.dylib 0x391376af objc_exception_throw + 38
2 CoreFoundation 0x2e9a0e8d -[NSException initWithCoder:]
3 UIKit 0x3111f48f -[UIView(Internal) _addSubview:positioned:relativeTo:] + 110
4 UIKit 0x3111f417 -[UIView(Hierarchy) addSubview:] + 30
5 UIKit 0x312e7c2f __53-[_UINavigationParallaxTransition animateTransition:]_block_invoke + 1402
6 UIKit 0x311256e5 +[UIView(Animation) performWithoutAnimation:] + 72
7 UIKit 0x312e7479 -[_UINavigationParallaxTransition animateTransition:] + 728
8 UIKit 0x312a4ba7 -[UINavigationController _startCustomTransition:] + 2614
9 UIKit 0x311c2273 -[UINavigationController _startDeferredTransitionIfNeeded:] + 418
10 UIKit 0x311c207d -[UINavigationController __viewWillLayoutSubviews] + 44
11 UIKit 0x311c2015 -[UILayoutContainerView layoutSubviews] + 184
12 UIKit 0x31113da3 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 346
13 QuartzCore 0x30d9ac6b -[CALayer layoutSublayers] + 142
14 QuartzCore 0x30d9647b CA::Layer::layout_if_needed(CA::Transaction*) + 350
15 QuartzCore 0x30d9630d CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 16
16 QuartzCore 0x30d95d1f CA::Context::commit_transaction(CA::Transaction*) + 230
17 QuartzCore 0x30d95b2f CA::Transaction::commit() + 314
18 QuartzCore 0x30d8f85d CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 56
19 CoreFoundation 0x2e96c1cd
20 CoreFoundation 0x2e969b71 __CFRunLoopDoObservers + 284
21 CoreFoundation 0x2e969eb3 __CFRunLoopRun + 730
22 CoreFoundation 0x2e8d4c27 CFRunLoopRunSpecific + 522
23 CoreFoundation 0x2e8d4a0b CFRunLoopRunInMode + 106
24 GraphicsServices 0x335c8283 GSEventRunModal + 138
25 UIKit 0x31178049 UIApplicationMain + 1136
26 Tapastic 0x000764ef main (main.m:16)
27 Tapastic 0x00075bf0 start
I cannot find where this crash happened in codes. So how can I find where this crash is and fix it? Please let me know. Thanks in advance.
Related
My app has many random crashes recently. Fabric shows the crash rate is about 1%. The crash session number and the crash user number is very close, which means it's very random.
The crash shows several different callstacks on Fabric, here are three of them.
==========1===============
#0. Crashed: com.apple.main-thread
0 QuartzCore 0x188715730 CALayerGetSuperlayer + 20
1 UIKit 0x188dd6fa0 -[UIView(Hierarchy) superview] + 44
2 UIKit 0x188dd7a88 -[UIView nextResponder] + 108
3 UIKit 0x188e9d99c -[UIResponder _containsResponder:] + 56
4 UIKit 0x188ecfc80 -[UITransitionView transition:fromView:toView:removeFromView:] + 576
5 UIKit 0x188f13238 -[UITabBarController transitionFromViewController:toViewController:transition:shouldSetSelected:] + 1536
6 UIKit 0x188f12aec -[UITabBarController _setSelectedViewController:] + 360
7 UIKit 0x188fda30c -[UITabBarController _tabBarItemClicked:] + 336
8 UIKit 0x188e11398 -[UIApplication sendAction:to:from:forEvent:] + 96
9 UIKit 0x188fda160 -[UITabBar _sendAction:withEvent:] + 468
10 UIKit 0x188e11398 -[UIApplication sendAction:to:from:forEvent:] + 96
11 UIKit 0x188dfa474 -[UIControl _sendActionsForEvents:withEvent:] + 612
12 UIKit 0x188fd9d98 -[UITabBar(Static) _buttonUp:] + 128
13 UIKit 0x188e11398 -[UIApplication sendAction:to:from:forEvent:] + 96
14 UIKit 0x188dfa474 -[UIControl _sendActionsForEvents:withEvent:] + 612
15 UIKit 0x188e10d34 -[UIControl touchesEnded:withEvent:] + 592
16 UIKit 0x188dcff54 _UIGestureRecognizerUpdate + 8536
17 CoreFoundation 0x18431c2a4 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
18 CoreFoundation 0x184319230 __CFRunLoopDoObservers + 360
19 CoreFoundation 0x184319610 __CFRunLoopRun + 836
20 CoreFoundation 0x1842452d4 CFRunLoopRunSpecific + 396
21 GraphicsServices 0x18dc9b6fc GSEventRunModal + 168
22 UIKit 0x188e42f40 UIApplicationMain + 1488
======================2=======================
#0. Crashed: com.apple.main-thread
0 QuartzCore 0x18e7ca1d0 CALayerGetSuperlayer + 20
1 UIKit 0x191e4e9d4 -[UIView(UIKitManual) superview] + 128
2 UIKit 0x1915d3a5c -[UIView nextResponder] + 120
3 UIKit 0x19197d620 -[UIResponder _canChangeFirstResponder:toResponder:] + 64
4 UIKit 0x19165c01c -[UIResponder becomeFirstResponder] + 224
5 UIKit 0x19169b118 -[UINavigationController navigationTransitionView:didStartTransition:] + 760
6 UIKit 0x1917758ac -[UINavigationController _startCustomTransition:] + 3852
7 UIKit 0x19168f7bc -[UINavigationController _startDeferredTransitionIfNeeded:] + 676
8 UIKit 0x19168f424 -[UINavigationController __viewWillLayoutSubviews] + 64
9 UIKit 0x19168f388 -[UILayoutContainerView layoutSubviews] + 188
10 UIKit 0x1915d5cc0 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1200
11 QuartzCore 0x18e7c6274 -[CALayer layoutSublayers] + 148
12 QuartzCore 0x18e7bade8 CA::Layer::layout_if_needed(CA::Transaction*) + 292
13 QuartzCore 0x18e7baca8 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 32
14 QuartzCore 0x18e73634c CA::Context::commit_transaction(CA::Transaction*) + 252
15 QuartzCore 0x18e75d3ac CA::Transaction::commit() + 504
16 QuartzCore 0x18e75de78 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 120
17 CoreFoundation 0x18b4549a8 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
18 CoreFoundation 0x18b452630 __CFRunLoopDoObservers + 372
19 CoreFoundation 0x18b452a7c __CFRunLoopRun + 956
20 CoreFoundation 0x18b382da4 CFRunLoopRunSpecific + 424
21 GraphicsServices 0x18cded074 GSEventRunModal + 100
22 UIKit 0x19163dc9c UIApplicationMain + 208
=========3========
#0. Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x18fe4c1a0 objc_retain + 16
1 UIKit 0x1974fba5c -[UIView nextResponder] + 120
2 UIKit 0x1978a45ec -[UIResponder _resignIfContainsFirstResponder] + 156
3 UIKit 0x1974fb76c -[UIView(Hierarchy) _willMoveToWindow:] + 568
4 UIKit 0x197507d88 -[UIView(Internal) _addSubview:positioned:relativeTo:] + 424
5 UIKit 0x197773000 __53-[_UINavigationParallaxTransition animateTransition:]_block_invoke_2 + 1556
6 UIKit 0x19750e964 +[UIView(Animation) performWithoutAnimation:] + 104
7 UIKit 0x1976e0950 __53-[_UINavigationParallaxTransition animateTransition:]_block_invoke + 260
8 UIKit 0x1977fd388 +[UIView(Internal) _performBlockDelayingTriggeringResponderEvents:] + 220
9 UIKit 0x1976e0450 -[_UINavigationParallaxTransition animateTransition:] + 1060
10 UIKit 0x19769d818 -[UINavigationController _startCustomTransition:] + 3704
11 UIKit 0x1975b77bc -[UINavigationController _startDeferredTransitionIfNeeded:] + 676
12 UIKit 0x1975b7424 -[UINavigationController __viewWillLayoutSubviews] + 64
13 UIKit 0x1975b7388 -[UILayoutContainerView layoutSubviews] + 188
14 UIKit 0x1974fdcc0 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1200
15 QuartzCore 0x1946ee274 -[CALayer layoutSublayers] + 148
16 QuartzCore 0x1946e2de8 CA::Layer::layout_if_needed(CA::Transaction*) + 292
17 QuartzCore 0x1946e2ca8 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 32
18 QuartzCore 0x19465e34c CA::Context::commit_transaction(CA::Transaction*) + 252
19 QuartzCore 0x1946853ac CA::Transaction::commit() + 504
20 UIKit 0x1974f3308 _afterCACommitHandler + 256
21 CoreFoundation 0x19137c9a8 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
22 CoreFoundation 0x19137a630 __CFRunLoopDoObservers + 372
23 CoreFoundation 0x19137aa7c __CFRunLoopRun + 956
24 CoreFoundation 0x1912aada4 CFRunLoopRunSpecific + 424
25 GraphicsServices 0x192d15074 GSEventRunModal + 100
26 UIKit 0x197565c9c UIApplicationMain + 208
I have no idea which page or what action caused this crash, and I can't reproduce this either.
Also tried Xcode analytics, zombie, memory instrument, with no luck.
Please let me know if you have any comments.
My app is crash on iPad launch, but works normally on iPhone.
I already tried to add a Symbolic breakpoint to -[UIView(Hierarchy) setNeedsLayout] but I didn't found what is causing this.
Stack trace:
Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x180354bec lookUpImpOrForward + 136
1 libobjc.A.dylib 0x18035f258 _objc_msgSend_uncached + 56
2 UIKit 0x1877679c4 -[UIView(Hierarchy) setNeedsLayout] + 196
3 UIKit 0x187a420ac __UIViewNoteTraitsDidChangeRecursively + 292
4 UIKit 0x187a421d0 __UIViewNoteTraitsDidChangeRecursively + 584
5 UIKit 0x187a421d0 __UIViewNoteTraitsDidChangeRecursively + 584
6 UIKit 0x187a421d0 __UIViewNoteTraitsDidChangeRecursively + 584
7 UIKit 0x187a421d0 __UIViewNoteTraitsDidChangeRecursively + 584
8 UIKit 0x187a421d0 __UIViewNoteTraitsDidChangeRecursively + 584
9 UIKit 0x187a421d0 __UIViewNoteTraitsDidChangeRecursively + 584
10 UIKit 0x187a421d0 __UIViewNoteTraitsDidChangeRecursively + 584
11 UIKit 0x187ab84a0 -[UIViewController _updateTraitsIfNecessary] + 312
12 UIKit 0x1877533e0 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 832
13 QuartzCore 0x184c1b40c -[CALayer layoutSublayers] + 148
14 QuartzCore 0x184c100e8 CA::Layer::layout_if_needed(CA::Transaction*) + 292
15 QuartzCore 0x184c0ffa8 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 32
16 QuartzCore 0x184b8cc64 CA::Context::commit_transaction(CA::Transaction*) + 252
17 QuartzCore 0x184bb40d0 CA::Transaction::commit() + 512
18 QuartzCore 0x184bb4af0 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 120
19 CoreFoundation 0x1818c17dc __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
20 CoreFoundation 0x1818bf40c __CFRunLoopDoObservers + 372
21 CoreFoundation 0x1818bf89c __CFRunLoopRun + 1024
22 CoreFoundation 0x1817ee048 CFRunLoopRunSpecific + 444
23 GraphicsServices 0x183271198 GSEventRunModal + 180
24 UIKit 0x1877c1628 -[UIApplication _run] + 684
25 UIKit 0x1877bc360 UIApplicationMain + 208
26 MyApp 0x10006c730 main (AppDelegate.swift:34)
27 libdispatch.dylib 0x1807d05b8 (Missing)
On Crashlytics I have different titles for the same crash, such as:
-[NSConcreteMapTable setNeedsLayout]: unrecognized selector sent to instance 0x17fbdca0
-[_NSConcreteObservation setNeedsLayout]: unrecognized selector sent to instance 0x170235da0
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000e9c2cbeb8
Is there another way to debug and figure out what is happening?
I have my app in alpha test, and using fabric to capture the crash logs. I had encountered a crash, and I have the below trace but have no idea what is going on. I tried to reproduce it with Xcode, but hardly can reproduce.
Could any one help on this? or share some ideas?
Thread : Crashed: com.apple.main-thread
0 libsystem_platform.dylib 0x0000000197c7d8d4 OSAtomicCompareAndSwap32Barrier + 12
1 libobjc.A.dylib 0x0000000197468120 realizeClass(objc_class*) + 100
2 libobjc.A.dylib 0x000000019746c930 lookUpImpOrForward + 224
3 libobjc.A.dylib 0x0000000197477db8 _objc_msgSend_uncached_impcache + 56
4 UIKit 0x000000018b66bef4 -[UINavigationController _startCustomTransition:] + 972
5 UIKit 0x000000018b57d630 -[UINavigationController _startDeferredTransitionIfNeeded:] + 468
6 UIKit 0x000000018b57d3fc -[UINavigationController __viewWillLayoutSubviews] + 56
7 UIKit 0x000000018b57d37c -[UILayoutContainerView layoutSubviews] + 200
8 UIKit 0x000000018b4c5d2c -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 572
9 QuartzCore 0x000000018ae1d994 -[CALayer layoutSublayers] + 168
10 QuartzCore 0x000000018ae18564 CA::Layer::layout_if_needed(CA::Transaction*) + 320
11 QuartzCore 0x000000018ae18408 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 32
12 QuartzCore 0x000000018ae17c08 CA::Context::commit_transaction(CA::Transaction*) + 276
13 QuartzCore 0x000000018ae1798c CA::Transaction::commit() + 436
14 UIKit 0x000000018b4c7c48 _UIApplicationHandleEventQueue + 1700
15 CoreFoundation 0x0000000186cd29ec __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
16 CoreFoundation 0x0000000186cd1c90 __CFRunLoopDoSources0 + 264
17 CoreFoundation 0x0000000186ccfd40 __CFRunLoopRun + 712
18 CoreFoundation 0x0000000186bfd0a4 CFRunLoopRunSpecific + 396
19 GraphicsServices 0x000000018fd975a4 GSEventRunModal + 168
20 UIKit 0x000000018b52eaa4 UIApplicationMain + 1488
21 MCompass 0x00000001001631c8 main (main.m:16)
22 libdyld.dylib 0x0000000197ad2a08 start + 4
It is hard to tell without seeing some more details, but maybe this can help: http://aplus.rs/2013/beware-a-crashing-bug-lurks-with-uinavigationcontroller-transitions/
I am facing a strange issue in one of my View Controllers, Every thing works fine and loads fine but when ever i set a Value to the View i get an Exception related to layer. However i am not setting any properties to the Layer either in Interface Builder or in the Code. Below is the Log that i receive which right now makes no sense to me
-[__NSCFNumber length]: unrecognized selector sent to instance 0x923a4e0
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFNumber length]: unrecognized selector sent to instance 0x923a4e0'
*** First throw call stack:
(
0 CoreFoundation 0x01ef31e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x01bf08e5 objc_exception_throw + 44
2 CoreFoundation 0x01f90243 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
3 CoreFoundation 0x01ee350b ___forwarding___ + 1019
4 CoreFoundation 0x01ee30ee _CF_forwarding_prep_0 + 14
5 UIKit 0x00a6d463 -[UILabel _shadow] + 45
6 UIKit 0x00a6e8c2 -[UILabel drawTextInRect:] + 70
7 UIKit 0x00a70dfc -[UILabel drawRect:] + 98
8 UIKit 0x0091f453 -[UIView(CALayerDelegate) drawLayer:inContext:] + 504
9 QuartzCore 0x00213f39 -[CALayer drawInContext:] + 123
10 QuartzCore 0x00213e6a _ZL16backing_callbackP9CGContextPv + 96
11 QuartzCore 0x001024fc CABackingStoreUpdate_ + 2656
12 QuartzCore 0x00213e02 ___ZN2CA5Layer8display_Ev_block_invoke + 93
13 QuartzCore 0x002482d7 x_blame_allocations + 15
14 QuartzCore 0x00213c6d _ZN2CA5Layer8display_Ev + 1519
15 QuartzCore 0x00213eb9 -[CALayer _display] + 33
16 QuartzCore 0x00213676 _ZN2CA5Layer7displayEv + 144
17 QuartzCore 0x00213e93 -[CALayer display] + 33
18 QuartzCore 0x00210fb7 -[CALayer displayIfNeeded] + 57
19 QuartzCore 0x002113b1 -[CALayer renderInContext:] + 192
20 QuartzCore 0x00213376 -[CALayer _renderSublayersInContext:] + 413
21 QuartzCore 0x002118bc -[CALayer renderInContext:] + 1483
22 QuartzCore 0x00213376 -[CALayer _renderSublayersInContext:] + 413
23 QuartzCore 0x002118bc -[CALayer renderInContext:] + 1483
24 QuartzCore 0x00213376 -[CALayer _renderSublayersInContext:] + 413
25 QuartzCore 0x002118bc -[CALayer renderInContext:] + 1483
26 SilverStar 0x00011fad -[UIView(ABExtras) imageInNavController:] + 525
27 SilverStar 0x00013005 -[CubeNavigationController pushViewController:animated:] + 549
28 SilverStar 0x0000c936 -[MSArticleViewController detailsbuttonTapped:] + 438
29 libobjc.A.dylib 0x01c02880 -[NSObject performSelector:withObject:withObject:] + 77
30 UIKit 0x008b23b9 -[UIApplication sendAction:to:from:forEvent:] + 108
31 UIKit 0x008b2345 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 61
32 UIKit 0x009b3bd1 -[UIControl sendAction:to:forEvent:] + 66
33 UIKit 0x009b3fc6 -[UIControl _sendActionsForEvents:withEvent:] + 577
34 UIKit 0x009b3243 -[UIControl touchesEnded:withEvent:] + 641
35 UIKit 0x00c482e3 _UIGestureRecognizerUpdate + 7166
36 UIKit 0x008f1a5a -[UIWindow _sendGesturesForEvent:] + 1291
37 UIKit 0x008f2971 -[UIWindow sendEvent:] + 1021
38 UIKit 0x008c45f2 -[UIApplication sendEvent:] + 242
39 UIKit 0x008ae353 _UIApplicationHandleEventQueue + 11455
40 CoreFoundation 0x01e7c77f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
41 CoreFoundation 0x01e7c10b __CFRunLoopDoSources0 + 235
42 CoreFoundation 0x01e991ae __CFRunLoopRun + 910
43 CoreFoundation 0x01e989d3 CFRunLoopRunSpecific + 467
44 CoreFoundation 0x01e987eb CFRunLoopRunInMode + 123
45 GraphicsServices 0x036c25ee GSEventRunModal + 192
46 GraphicsServices 0x036c242b GSEventRun + 104
47 UIKit 0x008b0f9b UIApplicationMain + 1225
Note: I am not sure which Code Section you might require. So, Let me know i will add in the Question here
You are passing NSNumber instead of NSString. Try this:
NSString *myString = [aNumber stringValue]; // aNumber is a NSNumber
self.label.text = myString
Hope this helps.. :)
Thread 0: Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x3a6285b0 objc_msgSend + 15
1 UIKit 0x348285f5 -[UINavigationController _startTransition:fromViewController:toViewController:] + 92
2 UIKit 0x348284c1 -[UINavigationController _startDeferredTransitionIfNeeded:] + 324
3 UIKit 0x347f94e9 -[UILayoutContainerView layoutSubviews] + 180
4 UIKit 0x347b8803 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 258
5 QuartzCore 0x34562d8b -[CALayer layoutSublayers] + 214
6 QuartzCore 0x34562929 CA::Layer::layout_if_needed(CA::Transaction*) + 460
7 QuartzCore 0x3456385d CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 16
8 QuartzCore 0x34563243 CA::Context::commit_transaction(CA::Transaction*) + 238
9 QuartzCore 0x34563051 CA::Transaction::commit() + 316
10 UIKit 0x34988369 -[UIApplication _sendOrderedOutContextsAndInvalidate:] + 112
11 UIKit 0x3483863f orderOutContextObserverCallout + 34
12 CoreFoundation 0x329826cd __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 20
13 CoreFoundation 0x329809c1 __CFRunLoopDoObservers + 276
14 CoreFoundation 0x32980c91 __CFRunLoopRun + 608
15 CoreFoundation 0x328f3ebd CFRunLoopRunSpecific + 356
16 CoreFoundation 0x328f3d49 CFRunLoopRunInMode + 104
17 GraphicsServices 0x364a62eb GSEventRunModal + 74
18 UIKit 0x34809301 UIApplicationMain + 1120
19 test 0x000f610f main (main.m:16)
I get this error in my crashlytics but not able to reproduce this error. Can any one help me to solve this how can i get rid of this crash.