App Store崩溃报告EXC_BREAKPOINT(SIGTRAP)

时间:2017-10-31 13:00:19

标签: ios swift xcode itunesconnect crash-reports

以下是从iTunes Connect下载的崩溃报告,苹果公司的人员说"我们无法检查您的应用,因为它在发布时已经崩溃"

我知道' 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

以下是静态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
    }
}

1 个答案:

答案 0 :(得分:0)

  

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

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