I have a swift view controller that is a subclass of JSQMessagesViewController and I'm seeing a weird SIGTRAP in viewDidLoad. Namely it occasionally happens when I try to set the background color. It happens sporadically so I'm not sure what might be happening.
override func viewDidLoad() {
super.viewDidLoad()
self.view.backgroundColor = UIColor.whiteColor()
}
Here's the crash log:
Thread 0 Crashed:
0 MyApp 0x00000001000ecc74 MyApp.MessageDetailViewController.viewDidLoad ()() (MessageDetailViewController.swift:130)
1 MyApp 0x00000001000ecc94 #objc MyApp.MessageDetailViewController.viewDidLoad ()() (MessageDetailViewController.swift:0)
2 UIKit 0x0000000187834b40 -[UIViewController loadViewIfRequired] + 992
3 UIKit 0x0000000187834744 -[UIViewController view] + 24
4 UIKit 0x00000001878f4f88 -[UINavigationController _updateScrollViewFromViewController:toViewController:] + 308
5 UIKit 0x00000001878f4238 -[UINavigationController _startTransition:fromViewController:toViewController:] + 140
6 UIKit 0x00000001878f3ddc -[UINavigationController _startDeferredTransitionIfNeeded:] + 864
7 UIKit 0x00000001878f3a04 -[UINavigationController __viewWillLayoutSubviews] + 56
8 UIKit 0x00000001878f396c -[UILayoutContainerView layoutSubviews] + 204
9 UIKit 0x00000001878300e4 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 652
10 QuartzCore 0x00000001851d6a28 -[CALayer layoutSublayers] + 144
11 QuartzCore 0x00000001851d1634 CA::Layer::layout_if_needed(CA::Transaction*) + 288
12 QuartzCore 0x00000001851d14f4 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 28
13 QuartzCore 0x00000001851d0b24 CA::Context::commit_transaction(CA::Transaction*) + 248
14 QuartzCore 0x00000001851d086c CA::Transaction::commit() + 508
15 QuartzCore 0x00000001851c9dd8 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 76
16 CoreFoundation 0x00000001826a07b0 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 28
17 CoreFoundation 0x000000018269e554 __CFRunLoopDoObservers + 368
18 CoreFoundation 0x000000018269e984 __CFRunLoopRun + 924
19 CoreFoundation 0x00000001825c8d10 CFRunLoopRunSpecific + 380
20 GraphicsServices 0x0000000183eb0088 GSEventRunModal + 176
21 UIKit 0x000000018789df70 UIApplicationMain + 200
22 MyApp 0x00000001000286b4 main (main.m:16)
23 ??? 0x00000001821668b8 0x0 + 0
The controller is presented modally in a navigation controller but then can transition to being pushed onto the nav stack (similar to composing a message in the stock sms app). Maybe it is possible that the lack of animation is causing an issue?
func controllerDidSendMessageInThread(controller: MessageDetailViewController, thread: Thread) {
self.dismissViewControllerAnimated(false, completion: nil)
let detail = MessageDetailViewController(thread: thread)
self.navigationController?.pushViewController(detail, animated: animated)
}
Related
I'm getting this crash on crashlytics (fabric), but unable to reproduce it or understand its origin based on the traceback.
Crashed: com.apple.main-thread
0 MyApp 0x1001080a0 MyViewController.viewWillAppear(Bool) -> () (MyViewController.swift:135)
1 MyApp 0x1001080d0 #objc MyViewController.viewWillAppear(Bool) -> () (MyViewController.swift)
2 UIKit 0x18868bbf4 -[UIViewController _setViewAppearState:isAnimating:] + 632
3 UIKit 0x18868b964 -[UIViewController __viewWillAppear:] + 156
4 UIKit 0x1888101d4 -[UINavigationController _startCustomTransition:] + 1144
5 UIKit 0x18872ab78 -[UINavigationController _startDeferredTransitionIfNeeded:] + 676
6 UIKit 0x18872a7e0 -[UINavigationController __viewWillLayoutSubviews] + 64
7 UIKit 0x18872a744 -[UILayoutContainerView layoutSubviews] + 188
8 UIKit 0x18867107c -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1200
9 QuartzCore 0x185861274 -[CALayer layoutSublayers] + 148
10 QuartzCore 0x185855de8 CA::Layer::layout_if_needed(CA::Transaction*) + 292
11 QuartzCore 0x185855ca8 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 32
12 QuartzCore 0x1857d134c CA::Context::commit_transaction(CA::Transaction*) + 252
13 QuartzCore 0x1857f83ac CA::Transaction::commit() + 504
14 UIKit 0x1888f2524 _UIApplicationFlushRunLoopCATransactionIfTooLate + 172
15 UIKit 0x188e689f8 __handleEventQueue + 4916
16 UIKit 0x188e68b9c __handleHIDEventFetcherDrain + 148
17 CoreFoundation 0x1824f142c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
18 CoreFoundation 0x1824f0d9c __CFRunLoopDoSources0 + 540
19 CoreFoundation 0x1824ee9a8 __CFRunLoopRun + 744
20 CoreFoundation 0x18241eda4 CFRunLoopRunSpecific + 424
21 GraphicsServices 0x183e88074 GSEventRunModal + 100
22 UIKit 0x1886d9058 UIApplicationMain + 208
23 MyApp 0x1009052fc main (AppDelegate.swift:16)
24 libdyld.dylib 0x18142d59c start + 4
The code in MyViewController:
#IBOutlet weak var someConstraint: NSLayoutConstraint!
#IBOutlet weak var button: UIButton!
let minHeight: CGFloat = 2.0
let cValue: CGFloat = 32.0
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
let aValue = button.frame.origin.y - UIApplication.shared.statusBarFrame.height
let bValue = button.bounds.height + minHeight
someConstraint.constant = max(aValue - bValue, cValue) // --> Crash here, line 135
}
Update: SomeConstraint is not nil.
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?
We have an App in production and received some EXC_BAD_ACCESS KERN_INVALID_ADDRESS crashes, when accessing a new variable inside User (a subclass of PFUser).
class User : PFUser {
#NSManaged var name: String!
#NSManaged var age: Int
...
var newVariable: Int = 0
}
Since Parse caches PFUser, the cached version of currentUser (from the previous version) does not contain newVariable. After calling .fetch() on User.currentUser() the App stops crashing.
Here's the crash log:
Thread : Crashed: com.apple.main-thread
0 libGSFontCache.dylib 0x2000000000000 (Missing)
1 APP 0x1001d8b54 AvatarImageView.(updateUI in _0CCBFAE82915B0F511DDDA83596201DC)() -> () (AvatarImageView.swift:119)
2 APP 0x1001d9a48 specialized AvatarImageView.user.setter (AvatarImageView.swift:37)
3 APP 0x1001d783c AvatarImageView.user.setter (AvatarImageView.swift)
4 APP 0x1001dbea4 ProfileHeaderView.(initView in _8556F2EAEF99C54ED4DABB5A0C260DAE)() -> () (ProfileHeaderView.swift:98)
5 APP 0x1001db7f4 ProfileHeaderView.init(type : ProfileHeaderView.ViewType, user : User, buddy : Buddy?) -> ProfileHeaderView (ProfileHeaderView.swift:66)
6 APP 0x10018c49c ProfileViewController.initView() -> () (ProfileViewController.swift:123)
7 APP 0x1000d9258 BaseViewController.viewDidLoad() -> () (BaseViewController.swift:52)
8 APP 0x10018bd64 ProfileViewController.viewDidLoad() -> () (ProfileViewController.swift:79)
9 APP 0x10018bf88 #objc ProfileViewController.viewDidLoad() -> () (ProfileViewController.swift)
10 UIKit 0x1862ec0c0 -[UIViewController loadViewIfRequired] + 996
11 UIKit 0x1863abda8 -[UINavigationController _layoutViewController:] + 72
12 UIKit 0x1863abc80 -[UINavigationController _updateScrollViewFromViewController:toViewController:] + 416
13 UIKit 0x1863aaec8 -[UINavigationController _startTransition:fromViewController:toViewController:] + 144
14 UIKit 0x1863aaa6c -[UINavigationController _startDeferredTransitionIfNeeded:] + 868
15 UIKit 0x1863aa694 -[UINavigationController __viewWillLayoutSubviews] + 60
16 UIKit 0x1863aa5fc -[UILayoutContainerView layoutSubviews] + 208
17 UIKit 0x1862e7778 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 656
18 QuartzCore 0x183cf6b2c -[CALayer layoutSublayers] + 148
19 QuartzCore 0x183cf1738 CA::Layer::layout_if_needed(CA::Transaction*) + 292
20 QuartzCore 0x183cf15f8 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 32
21 QuartzCore 0x183cf0c94 CA::Context::commit_transaction(CA::Transaction*) + 252
22 QuartzCore 0x183cf09dc CA::Transaction::commit() + 512
23 QuartzCore 0x183cea0cc CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 80
24 CoreFoundation 0x1815b0588 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
25 CoreFoundation 0x1815ae32c __CFRunLoopDoObservers + 372
26 CoreFoundation 0x1814dd6a0 CFRunLoopRunSpecific + 416
27 UIKit 0x18635a580 -[UIApplication _run] + 460
28 UIKit 0x186354d90 UIApplicationMain + 204
29 APP 0x1000c3dfc main (AppDelegate.swift:17)
30 libdispatch.dylib 0x18107e8b8 (Missing)
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/
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.