我有一个swift视图控制器,它是JSQMessagesViewController的子类,我在viewDidLoad
中看到了一个奇怪的SIGTRAP。也就是说,当我尝试设置背景颜色时偶尔会发生这种情况。它偶尔会发生,所以我不确定会发生什么。
override func viewDidLoad() {
super.viewDidLoad()
self.view.backgroundColor = UIColor.whiteColor()
}
这是崩溃日志:
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
控制器以模态方式呈现在导航控制器中,但随后可以转换为被推送到导航堆栈(类似于在股票短信应用程序中编写消息)。也许缺少动画可能导致问题?
func controllerDidSendMessageInThread(controller: MessageDetailViewController, thread: Thread) {
self.dismissViewControllerAnimated(false, completion: nil)
let detail = MessageDetailViewController(thread: thread)
self.navigationController?.pushViewController(detail, animated: animated)
}