App Store 崩溃报告 EXC_BREAKPOINT (SIGTRAP)
Posted
技术标签:
【中文标题】App Store 崩溃报告 EXC_BREAKPOINT (SIGTRAP)【英文标题】:App Store crash report EXC_BREAKPOINT (SIGTRAP) 【发布时间】:2017-10-31 13:00:19 【问题描述】:以下是从 iTunes Connect 下载的崩溃报告,Apple 人员说“我们无法审查您的应用,因为它在启动时崩溃了”。
我知道“EXC_BREAKPOINT (SIGTRAP)”的意思是 a non-optional type with a nil value
或 a 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
【问题讨论】:
显示发生崩溃的代码 这就是重点,我真的不知道崩溃发生在哪里。上面是线程 0 的截断,崩溃报告说崩溃,但我不知道哪个代码行崩溃了,因为我的设备上没有发生崩溃。 你能解释一下“ContentViewController.iphone.getter”中发生了什么吗? 请查看更新后的问题,我已经添加了“ContentViewController.iphone.getter”的代码。 你是说stacktrace错了??或者??它说:SearchTableViewController
或某个情节提要控制器是您的主控制器。然后PageViewController
已加载并在崩溃发生时处于活动状态(通过笔尖加载)。 PageController
第 16 行调用 ContentViewController
在第 20 行崩溃。这次崩溃显然发生在 CloudKit
方法上。
【参考方案1】:
init!(_ rawValue: CGFloat) self.init(rawValue: rawValue)
您在这里使用强制展开初始化,但如果没有与传递的值对应的情况,枚举可以返回 nil 的情况。它可以是 iPad (768) 或 iPhone 4s (480)。所以你解包 nil 并且系统抛出异常。
【讨论】:
以上是关于App Store 崩溃报告 EXC_BREAKPOINT (SIGTRAP)的主要内容,如果未能解决你的问题,请参考以下文章
从 App Store 安装后应用程序崩溃。 Google Analytics 向我发送实例崩溃报告<已编辑>
如何调试 iPhone 应用程序崩溃日志。仅在 App Store 购买的版本中崩溃,而不是在开发中