App Store 崩溃报告 EXC_BREAKPOINT (SIGTRAP)

App Store crash report EXC_BREAKPOINT (SIGTRAP)

下面是从 iTunes Connect 下载的崩溃报告,苹果人说 "We were unable to review your app as it crashed on launch"

我知道 'EXC_BREAKPOINT (SIGTRAP)' 表示 a non-optional type with a nil valuea failed forced type conversion,我检查了第 0、1、2 和 41 行关注我的应用程序 属性、新安装和尝试从旧版本更新,全部在真实设备上,一切正常,没有崩溃发生。我不知道崩溃发生在哪里?

你能给我一些建议很有帮助。非常感谢!!!

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

Filtered syslog:
None found

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   Cloud                           0x0000000101066d5c specialized static ContentViewController.iphone.getter + 388444 (ContentViewController.swift:20)
1   Cloud                           0x0000000101049584 specialized PageViewController.init(coder:) + 267652 (PageViewController.swift:16)
2   Cloud                           0x000000010104657c @objc PageViewController.init(coder:) + 255356 (PageViewController.swift:0)
3   UIKit                           0x000000018acee8bc -[UIClassSwapper initWithCoder:] + 248
4   UIKit                           0x000000018ae97588 UINibDecoderDecodeObjectForValue + 688
5   UIKit                           0x000000018ae972c0 -[UINibDecoder decodeObjectForKey:] + 104
6   UIKit                           0x000000018acee560 -[UIRuntimeConnection initWithCoder:] + 188
7   UIKit                           0x000000018ae97588 UINibDecoderDecodeObjectForValue + 688
8   UIKit                           0x000000018ae97700 UINibDecoderDecodeObjectForValue + 1064
9   UIKit                           0x000000018ae972c0 -[UINibDecoder decodeObjectForKey:] + 104
10  UIKit                           0x000000018aced8a0 -[UINib instantiateWithOwner:options:] + 1168
11  UIKit                           0x000000018b06a7f0 -[UIStoryboard instantiateViewControllerWithIdentifier:] + 196
12  UIKit                           0x000000018a9d08dc -[UIApplication _loadMainStoryboardFileNamed:bundle:] + 124
13  UIKit                           0x000000018a7d6cdc -[UIApplication _loadMainInterfaceFile] + 264
14  UIKit                           0x000000018a9cf5c0 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1420
15  UIKit                           0x000000018ac5d454 __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 800
16  UIKit                           0x000000018af2d1f0 +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 160
17  UIKit                           0x000000018ac5d0b8 -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 252
18  UIKit                           0x000000018ac5d928 -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 748
19  UIKit                           0x000000018b3c66e8 __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 260
20  UIKit                           0x000000018b3c658c -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 448
21  UIKit                           0x000000018b1429c0 __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 220
22  UIKit                           0x000000018b2d7fc8 _performActionsWithDelayForTransitionContext + 112
23  UIKit                           0x000000018b142870 -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 252
24  UIKit                           0x000000018af2c850 -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 364
25  UIKit                           0x000000018a9cde28 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 540
26  UIKit                           0x000000018add16ec -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 364
27  FrontBoardServices              0x00000001839f9768 -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 364
28  FrontBoardServices              0x0000000183a02070 __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 224
29  libdispatch.dylib               0x0000000180cdd048 _dispatch_client_callout + 16
30  libdispatch.dylib               0x0000000180ce46c8 _dispatch_block_invoke_direct$VARIANT$mp + 288
31  FrontBoardServices              0x0000000183a2da04 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 36
32  FrontBoardServices              0x0000000183a2d6a8 -[FBSSerialQueue _performNext] + 404
33  FrontBoardServices              0x0000000183a2dc44 -[FBSSerialQueue _performNextFromRunLoopSource] + 56
34  CoreFoundation                  0x0000000181300358 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
35  CoreFoundation                  0x00000001813002d8 __CFRunLoopDoSource0 + 88
36  CoreFoundation                  0x00000001812ffb60 __CFRunLoopDoSources0 + 204
37  CoreFoundation                  0x00000001812fd738 __CFRunLoopRun + 1048
38  CoreFoundation                  0x000000018121e2d8 CFRunLoopRunSpecific + 436
39  GraphicsServices                0x00000001830aff84 GSEventRunModal + 100
40  UIKit                           0x000000018a7cb880 UIApplicationMain + 208
41  Cloud                           0x0000000101010e04 main + 36356 (SearchTableViewController.swift:13)
42  libdyld.dylib                   0x0000000180d4256c start + 4

下面是static ContentViewController.iphone.getter的代码:

common.swift中定义:

enum iPhone: CGFloat {
case iPhoneSE = 568
case iPhone = 667
case iPhonePlus = 736
case iPhoneX = 812

init!(_ rawValue: CGFloat) {
    self.init(rawValue: rawValue)
}

}

ContentViewController.swift中定义:

    static var iphone: iPhone {
    let sceneHeight: CGFloat = UIScreen.main.bounds.height

    if iPhone(sceneHeight) == .iPhoneSE {
        return .iPhoneSE
    } else if iPhone(sceneHeight) == .iPhone {
        return .iPhone
    } else if iPhone(sceneHeight) == .iPhonePlus {
        return .iPhonePlus
    } else {
       return .iPhoneX
    }
}

init!(_ rawValue: CGFloat) { self.init(rawValue: rawValue) }

你在这里使用强制解包 init 但你有这样的情况,如果没有情况与传递的值对应,枚举可以 return nil。它可以是 iPad (768) 或 iPhone 4s (480)。所以你打开 nil 并且系统抛出异常。