呈现视图控制器时崩溃

时间:2018-07-23 18:31:33

标签: ios swift crash presentviewcontroller

尝试呈现视图控制器时,我的应用程序崩溃。它似乎只发生在设备中,而没有发生在模拟器中。

在归档TestFlight的构建之前,我还需要禁用断点吗?

这是崩溃日志:

Incident Identifier: E8E38296-EB9E-47FD-AC91-DC6231A32CE2
Beta Identifier:     C0074033-1ABA-4888-9906-B0E709FDC0D5
Hardware Model:      iPhone10,6
Process:             Darb [6943]
Path:                /private/var/containers/Bundle/Application/134E7292-FC58-4A08-9C73-E5B27C8BE5D2/Darb.app/Darb
Identifier:          com.dot.Darb
Version:             7 (3.6.14)
Beta:                YES
Code Type:           ARM-64 (Native)
Role:                Foreground
Parent Process:      launchd [1]
Coalition:           com.dot.Darb [2421]


Date/Time:           2018-07-23 10:51:48.2281 +0400
Launch Time:         2018-07-23 10:51:44.0025 +0400
OS Version:          iPhone OS 11.2.6 (15D100)
Baseband Version:    1.03.06
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                  0x183c2b164 __exceptionPreprocess + 124 (NSException.m:166)
1   libobjc.A.dylib                 0x182e74528 objc_exception_throw + 56 (objc-exception.mm:521)
2   CoreFoundation                  0x183c2ae2c -[NSException raise] + 12 (NSException.m:98)
3   Foundation                      0x184542630 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 272 (NSKeyValueCoding.m:418)
4   UIKit                           0x18d551134 -[UIViewController setValue:forKey:] + 104 (UIViewController.m:1275)
5   UIKit                           0x18d779224 -[UIRuntimeOutletConnection connect] + 124 (UIRuntimeOutletConnection.m:17)
6   CoreFoundation                  0x183b37d14 -[NSArray makeObjectsPerformSelector:] + 284 (NSArray.m:497)
7   UIKit                           0x18d777c18 -[UINib instantiateWithOwner:options:] + 1696 (UINib.m:0)
8   UIKit                           0x18d554be0 -[UIViewController _loadViewFromNibNamed:bundle:] + 372 (UIViewController.m:2866)
9   UIKit                           0x18d3028e8 -[UIViewController loadView] + 176 (UIViewController.m:2995)
10  UIKit                           0x18d1e56a8 -[UIViewController loadViewIfRequired] + 184 (UIViewController.m:3094)
11  UIKit                           0x18d1e55d8 -[UIViewController view] + 28 (UIViewController.m:3155)
12  UIKit                           0x18dd8ed24 -[_UIFullscreenPresentationController _setPresentedViewController:] + 92 (_UIFullscreenPresentationController.m:232)
13  UIKit                           0x18d52da18 -[UIPresentationController initWithPresentedViewController:presentingViewController:] + 140 (UIPresentationController.m:81)
14  UIKit                           0x18d55e84c -[UIViewController _presentViewController:withAnimationController:completion:] + 2676 (UIViewController.m:7081)
15  UIKit                           0x18d56188c __63-[UIViewController _presentViewController:animated:completion:]_block_invoke_2 + 68 (UIViewController.m:7543)
16  UIKit                           0x18d1f392c +[UIView(Animation) performWithoutAnimation:] + 104 (UIView.m:11877)
17  UIKit                           0x18d5617e0 __63-[UIViewController _presentViewController:animated:completion:]_block_invoke + 220 (UIViewController.m:7541)
18  UIKit                           0x18d561ca0 -[UIViewController _performCoordinatedPresentOrDismiss:animated:] + 528 (UIViewController.m:7621)
19  UIKit                           0x18d5616bc -[UIViewController _presentViewController:animated:completion:] + 188 (UIViewController.m:7552)
20  UIKit                           0x18d2c32d0 -[UIViewController presentViewController:animated:completion:] + 160 (UIViewController.m:7565)
21  Darb                            0x1025fdd7c MainViewController.viewDidLoad() + 5940 (MainViewController.swift:320)
22  Darb                            0x1025ff3c0 @objc MainViewController.viewDidLoad() + 28 (MainViewController.swift:0)
23  UIKit                           0x18d1e5a00 -[UIViewController loadViewIfRequired] + 1040 (UIViewController.m:3133)
24  UIKit                           0x18d28ceb8 -[UINavigationController _updateScrollViewFromViewController:toViewController:] + 76 (UINavigationController.m:6345)
25  UIKit                           0x18d28c358 -[UINavigationController _startTransition:fromViewController:toViewController:] + 196 (UINavigationController.m:6380)
26  UIKit                           0x18d28bd5c -[UINavigationController _startDeferredTransitionIfNeeded:] + 1168 (UINavigationController.m:6601)
27  UIKit                           0x18d28b7d8 -[UINavigationController __viewWillLayoutSubviews] + 164 (UINavigationController.m:6872)
28  UIKit                           0x18d28b6d8 -[UILayoutContainerView layoutSubviews] + 188 (UILayoutContainerView.m:87)
29  UIKit                           0x18d1e2e18 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1276 (UIView.m:15124)
30  QuartzCore                      0x187c6f948 -[CALayer layoutSublayers] + 184 (CALayer.mm:9302)
31  QuartzCore                      0x187c73ad0 CA::Layer::layout_if_needed(CA::Transaction*) + 332 (CALayer.mm:9182)
32  QuartzCore                      0x187be031c CA::Context::commit_transaction(CA::Transaction*) + 336 (CALayer.mm:2416)
33  QuartzCore                      0x187c07b40 CA::Transaction::commit() + 540 (CATransactionInternal.mm:425)
34  UIKit                           0x18d45eb6c __34-[UIApplication _firstCommitBlock]_block_invoke_2 + 140 (UIApplication.m:9904)
35  CoreFoundation                  0x183bd3590 __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 20 (CFRunLoop.c:1840)
36  CoreFoundation                  0x183bd2e60 __CFRunLoopDoBlocks + 288 (CFRunLoop.c:1881)
37  CoreFoundation                  0x183bd0b70 __CFRunLoopRun + 1068 (CFRunLoop.c:2922)
38  CoreFoundation                  0x183af0c58 CFRunLoopRunSpecific + 436 (CFRunLoop.c:3245)
39  GraphicsServices                0x18599cf84 GSEventRunModal + 100 (GSEvent.c:2245)
40  UIKit                           0x18d2495c4 UIApplicationMain + 236 (UIApplication.m:3956)
41  Darb                            0x1025b1064 main + 56 (AppDelegate.swift:19)
42  libdyld.dylib                   0x18361056c start + 4

有人可以查看一下日志,并向我指出正确的方向吗?

以下是崩溃日志指向的代码

let lastLaunch = Foundation.UserDefaults.standard.double(forKey: "lastLaunch")
let lastLaunchDate = Date(timeIntervalSince1970: lastLaunch)

let lastLaunchIsToday = Calendar.current.isDateInToday(lastLaunchDate)
if !lastLaunchIsToday {
    // Show the GIF
    let zayedVC: ZayedVideoViewController = self.storyboard?.instantiateViewController(withIdentifier: "ZayedVC") as! ZayedVideoViewController
    zayedVC.providesPresentationContextTransitionStyle = true
    zayedVC.definesPresentationContext = true
    zayedVC.isModalInPopover = true
    zayedVC.modalPresentationStyle = .overFullScreen
    self.navigationController?.present(zayedVC, animated: false, completion: nil)
}

Foundation.UserDefaults.standard.set(Date().timeIntervalSince1970, forKey: "lastLaunch")

1 个答案:

答案 0 :(得分:0)

好的

我设法解决了这个问题,我的问题是插座连接断开。

我已将其从情节提要中删除,并且效果很好

相关问题