我收到了来自生产的崩溃日志,无法理解如何重现它。根据我掌握的信息,它只在装有 iOS 9.3 的 iPad 上发生过一次。
这次崩溃发生在我的最新版本之后,我使用 VIPER 方法来表达我的一些观点。我已经搜索了互联网,并认为我的问题可能是由 Leo Natan 在他的评论中描述的类似问题引起的。但我不确定并且想知道如何重现和解决这个问题。我什至不明白正在呈现什么弹出框。
这是我的崩溃日志(已删除二进制图像):
Incident Identifier: 9476D9A8-1468-4A68-8F71-DA8B7F083172
CrashReporter Key: 21204b1ae5f574c63137a73b5a4a50aeb35fe287
Hardware Model: iPad2,5
Process: CafeManager [24058]
Path: /private/var/containers/Bundle/Application/FF4319BD-9D3B-4178-B5FB-0B4641CB9D6E/CafeManager.app/CafeManager
Identifier: iGlock.CafeManager.com
Version: 1 (1.2.5)
Code Type: ARM (Native)
Parent Process: launchd [1]
Date/Time: 2018-08-27 03:16:59.59 +0300
Launch Time: 2018-08-27 03:04:59.59 +0300
OS Version: iOS 9.3.5 (13G36)
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Triggered by Thread: 0
Last Exception Backtrace:
0 CoreFoundation 0x210df916 __exceptionPreprocess + 122 (NSException.m:162)
1 libobjc.A.dylib 0x2087ae12 objc_exception_throw + 34 (objc-exception.mm:531)
2 UIKit 0x25f4b480 -[UIPopoverPresentationController presentationTransitionWillBegin] + 3336 (UIPopoverPresentationController.m:1201)
3 UIKit 0x259abe8e __71-[UIPresentationController _initViewHierarchyForPresentationSuperview:]_block_invoke + 1794 (UIPresentationController.m:1137)
4 UIKit 0x259a9dae __56-[UIPresentationController runTransitionForCurrentState]_block_invoke + 378 (UIPresentationController.m:705)
5 UIKit 0x259034c4 _runAfterCACommitDeferredBlocks + 264 (UIApplication.m:2386)
6 UIKit 0x2590f7d6 _cleanUpAfterCAFlushAndRunDeferredBlocks + 86 (UIApplication.m:2365)
7 UIKit 0x2564db18 _afterCACommitHandler + 80 (UIApplication.m:2416)
8 CoreFoundation 0x210a16c4 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 16 (CFRunLoop.c:1620)
9 CoreFoundation 0x2109f9c8 __CFRunLoopDoObservers + 276 (CFRunLoop.c:1716)
10 CoreFoundation 0x2109fdfa __CFRunLoopRun + 954 (CFRunLoop.c:2558)
11 CoreFoundation 0x20fef224 CFRunLoopRunSpecific + 516 (CFRunLoop.c:2814)
12 CoreFoundation 0x20fef010 CFRunLoopRunInMode + 104 (CFRunLoop.c:2844)
13 GraphicsServices 0x225dfac4 GSEventRunModal + 156 (GSEvent.c:2245)
14 UIKit 0x256c3184 UIApplicationMain + 140 (UIApplication.m:3772)
15 CafeManager 0x9973c main + 48 (AppDelegate.swift:20)
16 libdyld.dylib 0x20c9786e tlv_get_addr + 42 (threadLocalHelpers.s:311)
Thread 0 name:
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x20d6ac5c __pthread_kill + 8
1 libsystem_pthread.dylib 0x20e14732 pthread_kill + 62 (pthread.c:1247)
2 libsystem_c.dylib 0x20cff0ac abort + 108 (abort.c:91)
3 libc++abi.dylib 0x20856ae4 abort_message + 108 (abort_message.cpp:47)
4 libc++abi.dylib 0x2086f69e default_terminate_handler() + 266 (cxa_default_handlers.cpp:67)
5 libobjc.A.dylib 0x2087b0b0 _objc_terminate() + 192 (objc-exception.mm:678)
6 libc++abi.dylib 0x2086ce16 std::__terminate(void (*)()) + 78 (cxa_handlers.cpp:67)
7 libc++abi.dylib 0x2086c8f8 __cxa_rethrow + 100 (cxa_exception.cpp:480)
8 libobjc.A.dylib 0x2087af5e objc_exception_rethrow + 42 (objc-exception.mm:581)
9 CoreFoundation 0x20fef2ae CFRunLoopRunSpecific + 654 (CFRunLoop.c:2827)
10 CoreFoundation 0x20fef014 CFRunLoopRunInMode + 108 (CFRunLoop.c:2844)
11 GraphicsServices 0x225dfac8 GSEventRunModal + 160 (GSEvent.c:2245)
12 UIKit 0x256c3188 UIApplicationMain + 144 (UIApplication.m:3772)
13 CafeManager 0x00099740 main + 52 (AppDelegate.swift:20)
14 libdyld.dylib 0x20c97872 start + 2 (start_glue.s:64)
Thread 1 name:
Thread 1:
0 libsystem_kernel.dylib 0x20d6c2f8 kevent_qos + 24
1 libdispatch.dylib 0x20c61d60 _dispatch_mgr_invoke + 256 (source.c:2542)
2 libdispatch.dylib 0x20c61abe _dispatch_mgr_thread$VARIANT$mp + 38 (source.c:2573)
Thread 2:
0 libsystem_kernel.dylib 0x20d6b864 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x20e11b34 _pthread_wqthread + 1036 (pthread.c:1999)
2 libsystem_pthread.dylib 0x20e11718 start_wqthread + 8 (pthread_asm.s:147)
Thread 3:
0 libsystem_kernel.dylib 0x20d6b864 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x20e11b34 _pthread_wqthread + 1036 (pthread.c:1999)
2 libsystem_pthread.dylib 0x20e11718 start_wqthread + 8 (pthread_asm.s:147)
Thread 4:
0 libsystem_kernel.dylib 0x20d6b864 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x20e11b34 _pthread_wqthread + 1036 (pthread.c:1999)
2 libsystem_pthread.dylib 0x20e11718 start_wqthread + 8 (pthread_asm.s:147)
Thread 5:
0 libsystem_kernel.dylib 0x20d6b864 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x20e11b34 _pthread_wqthread + 1036 (pthread.c:1999)
2 libsystem_pthread.dylib 0x20e11718 start_wqthread + 8 (pthread_asm.s:147)
Thread 6:
0 libsystem_kernel.dylib 0x20d6b864 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x20e11b34 _pthread_wqthread + 1036 (pthread.c:1999)
2 libsystem_pthread.dylib 0x20e11718 start_wqthread + 8 (pthread_asm.s:147)
Thread 0 crashed with ARM Thread State (32-bit):
r0: 0x00000000 r1: 0x00000000 r2: 0x00000000 r3: 0x20cf1b1d
r4: 0x00000006 r5: 0x38084000 r6: 0x372c2304 r7: 0x002b44e8
r8: 0x1778f4e0 r9: 0x208708fd r10: 0x398938a5 r11: 0x1778f504
ip: 0x00000148 sp: 0x002b44dc lr: 0x20e14733 pc: 0x20d6ac5c
cpsr: 0x00000010
Binary Images:
我有一种感觉,当我的一个 VIPER 模块被调用时,可能会发生这种崩溃。它应该以这种方式工作:
当前视图控制器 (MVC) 通过调用此方法组装模块:
class PeriodPickerAssembly: NSObject {
static func assembleModule() -> PeriodPickerRouter {
let router = PeriodPickerRouter()
let presenter = PeriodPickerPresenter()
let viewController = UIStoryboard.init(name: "PeriodPicker", bundle: nil).instantiateViewController(withIdentifier: "PeriodPickerViewController") as! PeriodPickerViewController
viewController.periodPickerPresenter = presenter
presenter.view = viewController
presenter.router = router
router.presenter = presenter
router.view = viewController
return router
}
}
然后方法 choosePeriodWithParams 将视图显示为弹出框:
class PeriodPickerRouter: NSObject, PeriodPickerRouterInterface, PeriodPickerInterface {
weak var presenter: PeriodPickerPresenter!
weak var delegate: PeriodPickerDelegate!
weak var view : UIViewController!
// Ingoing
func choosePeriodWithParams(startDateLimit: Date?, endDateLimit: Date?, currentStartDate: Date?, currentEndDate: Date?) {
view.modalPresentationStyle = .popover
view.popoverPresentationController?.sourceView = UIApplication.topViewController()?.view
appDelegate.window?.rootViewController?.present(view!, animated: true, completion: nil)
presenter.configureDatePickers(startDateLimit: startDateLimit, endDateLimit: endDateLimit, currentStartDate: currentStartDate, currentEndDate: currentEndDate)
}
// Outgoing
func dismissPeriodPicker() {
view.dismiss(animated: true, completion: nil)
}
func periodPickerDidChoosePeriod(startDate: Date, endDate: Date) {
delegate.periodPickerDidChoosePeriod(startDate: startDate, endDate: endDate)
view.dismiss(animated: true, completion: nil)
}}
我认为这两行可能与问题有关。但不确定如何证明:
view.popoverPresentationController?.sourceView = UIApplication.topViewController()?.view
appDelegate.window?.rootViewController?.present(view!, animated: true, completion: nil)