gpt4 book ai didi

ios - EXC_CRASH (SIGABRT) UIPopoverPresentationController presentationTransitionWillBegin

转载 作者:行者123 更新时间:2023-12-04 15:54:27 28 4
gpt4 key购买 nike

我收到了来自生产环境的崩溃日志,但无法理解如何重现它。根据我掌握的信息,它在装有 iOS 9.3 的 iPad 上只发生过一次。

这次崩溃发生在我发布最新版本之后,我在其中使用了 VIPER 方法论来表达我的一些观点。我在互联网上搜索过,假设我的问题可能是由 Leo Natan 在他的评论中描述的类似问题引起的 here .但我不确定并想知道如何重现和解决问题。我什至不明白显示的是什么弹出窗口。

这是我的崩溃日志(已删除二进制图像):

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 模块之一被调用时,可能会发生此崩溃。它应该以这种方式工作:

当前 View Controller (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 将 View 显示为弹出窗口:

    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)

最佳答案

终于在测试中发现了问题。这是一个愚蠢且众所周知的问题(真丢人,我忘了在 iPad 上正确测试我的应用程序)。但我仍然不明白如何分析该崩溃报告。

错误具有相同的文本,除了行号(没关系,因为代码已更改并且我在使用不同的弹出窗口时遇到了这个问题)。

2018-09-27 22:37:53.952 CafeManager[5235:253337] *** Terminating app due to uncaught exception 'NSGenericException', reason: 'Your application has presented a UIAlertController (<UIAlertController: 0x7fd2a0335c90>) of style UIAlertControllerStyleActionSheet. The modalPresentationStyle of a UIAlertController with this style is UIModalPresentationPopover. You must provide location information for this popover through the alert controller's popoverPresentationController. You must provide either a sourceView and sourceRect or a barButtonItem.  If this information is not known when you present the alert controller, you may provide it in the UIPopoverPresentationControllerDelegate method -prepareForPopoverPresentation.'
*** First throw call stack:
(
0 CoreFoundation 0x00000001099a6d85 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000109094deb objc_exception_throw + 48
2 UIKit 0x000000010ae3d396 -[UIPopoverPresentationController presentationTransitionWillBegin] + 3407
3 UIKit 0x000000010a5d3f44 __71-[UIPresentationController _initViewHierarchyForPresentationSuperview:]_block_invoke + 2035
4 UIKit 0x000000010a5d1b76 __56-[UIPresentationController runTransitionForCurrentState]_block_invoke + 309
5 UIKit 0x000000010a46ff62 _runAfterCACommitDeferredBlocks + 317
6 UIKit 0x000000010a483e4c _cleanUpAfterCAFlushAndRunDeferredBlocks + 95
7 UIKit 0x000000010a490147 _afterCACommitHandler + 90
8 CoreFoundation 0x00000001098cbc37 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
9 CoreFoundation 0x00000001098cbba7 __CFRunLoopDoObservers + 391
10 CoreFoundation 0x00000001098c17fb __CFRunLoopRun + 1147
11 CoreFoundation 0x00000001098c10f8 CFRunLoopRunSpecific + 488
12 GraphicsServices 0x000000010f54cad2 GSEventRunModal + 161
13 UIKit 0x000000010a463f09 UIApplicationMain + 171
14 CafeManager 0x0000000108227134 main + 68
15 libdyld.dylib 0x000000010dd0992d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)

更新:

2018-09-27 22:37:53.952 CafeManager[5235:253337] *** Terminating app due to uncaught exception 'NSGenericException', reason: 'Your application has presented a UIAlertController () of style UIAlertControllerStyleActionSheet. The modalPresentationStyle of a UIAlertController with this style is UIModalPresentationPopover. You must provide location information for this popover through the alert controller's popoverPresentationController. You must provide either a sourceView and sourceRect or a barButtonItem. If this information is not known when you present the alert controller, you may provide it in the UIPopoverPresentationControllerDelegate method -prepareForPopoverPresentation.'

Presenting a UIAlertController properly on an iPad using iOS 8

希望对大家有帮助。

关于ios - EXC_CRASH (SIGABRT) UIPopoverPresentationController presentationTransitionWillBegin,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52348864/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com