在推送消息时打开崩溃的iOS

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了在推送消息时打开崩溃的iOS相关的知识,希望对你有一定的参考价值。

我在打开推送通知时出现了崩溃,来自苹果的崩溃日志,问题出在哪里?

帮助阅读此日志

当用户打开推送时,我只需打开 "OrderDetailsVC"。

xception Type:  EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x00000001028b15f8
Termination Signal: Trace/BPT trap: 5
Termination Reason: Namespace SIGNAL, Code 0x5
Terminating Process: exc handler [870]
Triggered by Thread:  0

Thread 0 name:
Thread 0 Crashed:
0   Moitane                         0x00000001028b15f8 OrderDetailsVC.viewDidLoad() + 268 (OrderDetailsVC.swift:144)
1   Moitane                         0x00000001028b1618 @objc OrderDetailsVC.viewDidLoad() + 28 (<compiler-generated>:0)
2   UIKitCore                       0x00000001bdf7ae08 -[UIViewController _sendViewDidLoadWithAppearanceProxyObjectTaggingEnabled] + 100 (UIViewController.m:2283)
3   UIKitCore                       0x00000001bdf7f898 -[UIViewController loadViewIfRequired] + 936 (UIViewController.m:3382)
4   UIKitCore                       0x00000001bdf7fca0 -[UIViewController view] + 28 (UIViewController.m:3404)
5   UIKitCore                       0x00000001bdedf528 -[UINavigationController _startCustomTransition:] + 1180 (UINavigationController.m:1893)
6   UIKitCore                       0x00000001bdef33f0 -[UINavigationController _startDeferredTransitionIfNeeded:] + 688 (UINavigationController.m:6719)
7   UIKitCore                       0x00000001bdef4790 -[UINavigationController __viewWillLayoutSubviews] + 172 (UINavigationController.m:6988)
8   UIKitCore                       0x00000001bded7cf0 -[UILayoutContainerView layoutSubviews] + 224 (UILayoutContainerView.m:86)
9   UIKitCore                       0x00000001bea6ec7c -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 2144 (UIView.m:17176)
10  QuartzCore                      0x00000001c10084ac -[CALayer layoutSublayers] + 284 (CALayer.mm:9644)
11  QuartzCore                      0x00000001c100e604 CA::Layer::layout_if_needed(CA::Transaction*) + 468 (CALayer.mm:9518)
12  QuartzCore                      0x00000001c1019148 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 140 (CALayer.mm:2468)
13  QuartzCore                      0x00000001c0f61e34 CA::Context::commit_transaction(CA::Transaction*, double) + 296 (CAContextInternal.mm:1992)
14  QuartzCore                      0x00000001c0f8b7c4 CA::Transaction::commit() + 676 (CATransactionInternal.mm:438)
15  QuartzCore                      0x00000001c0f8c1d8 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 92 (CATransactionInternal.mm:890)
16  CoreFoundation                  0x00000001ba492fb8 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32 (CFRunLoop.c:1758)
17  CoreFoundation                  0x00000001ba48deac __CFRunLoopDoObservers + 420 (CFRunLoop.c:1868)
18  CoreFoundation                  0x00000001ba48e328 __CFRunLoopRun + 968 (CFRunLoop.c:2910)
19  CoreFoundation                  0x00000001ba48dc34 CFRunLoopRunSpecific + 424 (CFRunLoop.c:3192)
20  GraphicsServices                0x00000001c45d738c GSEventRunModal + 160 (GSEvent.c:2246)
21  UIKitCore                       0x00000001be5c022c UIApplicationMain + 1932 (UIApplication.m:4820)
22  Moitane                         0x0000000102887b70 main + 68 (LocalizableBtn.swift:19)
23  libdyld.dylib                   0x00000001ba315800 start + 4


答案

您的 viewDidLoad 在OrderDetailsVC.swift中(堆栈跟踪的第1和第2帧)是罪魁祸首。

0   Moitane                         0x00000001028b15f8 OrderDetailsVC.viewDidLoad() + 268 (OrderDetailsVC.swift:144)
1   Moitane                         0x00000001028b1618 @objc OrderDetailsVC.viewDidLoad() + 28 (<compiler-generated>:0)

以上是关于在推送消息时打开崩溃的iOS的主要内容,如果未能解决你的问题,请参考以下文章

WatchOS 3 在收到推送通知时崩溃

iOS远程推送点击消息跳转到指定页面

PhoneGap 的推送消息

点击推送消息跳转处理(iOS)

友盟-推送-Andorid-消息推送-打开通知消息进入特定Activity操作?

iOS 推送手机消息背后的技术