解决方案中心崩溃报告中

时间:2018-05-24 02:00:17

标签: ios swift crash

我的应用程序被应用程序商店拒绝了,因为有一个按钮会导致它在iPad上按下时崩溃。我没有iPad,这个bug在任何iPad模拟器上都是不可复制的。以下是决议中心发给我的崩溃报告:

{"app_name":"xxx","timestamp":"2018-05-23 14:18:37.70 -0700","app_version":"0.4.5","slice_uuid":"f7e0571c-a2a9-313c-ab7b-9a9109670ff2","adam_id":1387669409,"build_version":"1","bundleID":"com.b.xxx","share_with_app_devs":false,"is_first_party":false,"bug_type":"109","os_version":"iPhone OS 11.3.1 (15E302)","incident_id":"D5ADA937-9FAF-479B-A925-7B127B5E0C44","name":"xxx"}
Incident Identifier: D5ADA937-9FAF-479B-A925-7B127B5E0C44
CrashReporter Key:   cac3035154ad4b589b77fd30cfea229fc2cfaf20
Hardware Model:      xxx
Process:             xxx [1949]
Path:                /private/var/containers/Bundle/Application/FD86FF84-2DDF-4DFA-B23D-703D4A08316B/xxx.app/xxx
Identifier:          com.b.xxx
Version:             1 (0.4.5)
Code Type:           ARM-64 (Native)
Role:                Foreground
Parent Process:      launchd [1]
Coalition:           com.b.xxx [1153]


Date/Time:           2018-05-23 14:18:37.5753 -0700
Launch Time:         2018-05-23 14:18:31.9754 -0700
OS Version:          iPhone OS 11.3.1 (15E302)
Baseband Version:    6.55.00
Report Version:      104

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

Application Specific Information:
BUG IN CLIENT OF LIBDISPATCH: trying to lock recursively

Filtered syslog:
None found

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libdispatch.dylib               0x0000000180b03644 _dispatch_gate_wait_slow$VARIANT$mp + 180
1   libdispatch.dylib               0x0000000180b04334 dispatch_once_f$VARIANT$mp + 132
2   libdispatch.dylib               0x0000000180b04334 dispatch_once_f$VARIANT$mp + 132
3   xxx                             0x00000001006cc6ec specialized static TextFieldFactory.manufacture(for:with:) + 2868972 (TextFieldFactory.swift:13)
4   xxx                             0x00000001006535ac _T09xxx22GRADEDISPLAY_MAX_WIDTH12CoreGraphics7CGFloatVvpfiAEycfU_ + 2373036 (DimensionConstants.swift:0)
5   xxx                             0x00000001006532b8 globalinit_33_D344213E1027291683078D92DF0D6E22_func214 + 2372280 (DimensionConstants.swift:220)
6   libdispatch.dylib               0x0000000180b00ae4 _dispatch_client_callout + 16
7   libdispatch.dylib               0x0000000180b042ec dispatch_once_f$VARIANT$mp + 60
8   xxx                             0x00000001006cc6ec specialized static TextFieldFactory.manufacture(for:with:) + 2868972 (TextFieldFactory.swift:13)
9   xxx                             0x00000001006cac10 static TextFieldFactory.manufacture(for:with:) + 2862096 (TextFieldFactory.swift:0)
10  xxx                             0x0000000100614f2c _T09xxx04EditA4ViewC5titleAA9TextFieldCvgAFycfU_ + 2117420 (EditClassView.swift:26)
11  xxx                             0x000000010060ff90 EditClassView.beginInit() + 2097040 (EditClassView.swift:24)
12  xxx                             0x00000001006bc970 MView.init(sizeConstraint:) + 2804080 (MView.swift:0)
13  xxx                             0x0000000100614934 EditClassView.init(cCreateSemester:clss:sizeConstraint:) + 2115892 (EditClassView.swift:237)
14  xxx                             0x00000001007184f8 specialized CCreateSemester.createCreateCourseView(_:) + 3179768 (CCreateSemester.swift:667)
15  xxx                             0x000000010071393c CCreateSemester.setupNewSemester() + 3160380 (CCreateSemester.swift:594)
16  xxx                             0x000000010071030c CCreateSemester.viewDidLoad() + 3146508 (CCreateSemester.swift:0)
17  xxx                             0x0000000100711674 @objc CCreateSemester.viewDidLoad+ 3151476 () + 28
18  UIKit                           0x000000018adeaee0 -[UIViewController loadViewIfRequired] + 1020
19  UIKit                           0x000000018ae98e98 -[UINavigationController _updateScrollViewFromViewController:toViewController:] + 76
20  UIKit                           0x000000018ae98354 -[UINavigationController _startTransition:fromViewController:toViewController:] + 172
21  UIKit                           0x000000018ae97c90 -[UINavigationController _startDeferredTransitionIfNeeded:] + 1164
22  UIKit                           0x000000018ae97720 -[UINavigationController __viewWillLayoutSubviews] + 164
23  UIKit                           0x000000018ae8b424 -[UILayoutContainerView layoutSubviews] + 188
24  UIKit                           0x000000018ade3770 -[UIView+ 309104 (CALayerDelegate) layoutSublayersOfLayer:] + 1420
25  QuartzCore                      0x000000018538525c -[CALayer layoutSublayers] + 184
26  QuartzCore                      0x00000001853893ec CA::Layer::layout_if_needed+ 1209324 (CA::Transaction*) + 324
27  QuartzCore                      0x00000001852f5aa0 CA::Context::commit_transaction+ 604832 (CA::Transaction*) + 320
28  QuartzCore                      0x000000018531d5d0 CA::Transaction::commit+ 767440 () + 580
29  QuartzCore                      0x000000018531e450 CA::Transaction::observer_callback+ 771152 (__CFRunLoopObserver*, unsigned long, void*) + 92
30  CoreFoundation                  0x00000001811b6910 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
31  CoreFoundation                  0x00000001811b4238 __CFRunLoopDoObservers + 412
32  CoreFoundation                  0x00000001811b4884 __CFRunLoopRun + 1436
33  CoreFoundation                  0x00000001810d4da8 CFRunLoopRunSpecific + 552
34  GraphicsServices                0x00000001830b7020 GSEventRunModal + 100
35  UIKit                           0x000000018b0b578c UIApplicationMain + 236
36  xxx                             0x00000001004179b8 main + 31160 (PercentBasedUnequalField.swift:12)
37  libdyld.dylib                   0x0000000180b65fc0 start + 4

Thread 1:
0   libsystem_kernel.dylib          0x0000000180c95d84 __workq_kernreturn + 8
1   libsystem_pthread.dylib         0x0000000180e33eb4 _pthread_wqthread + 928
2   libsystem_pthread.dylib         0x0000000180e33b08 start_wqthread + 4

Thread 2:
0   libsystem_kernel.dylib          0x0000000180c95d84 __workq_kernreturn + 8
1   libsystem_pthread.dylib         0x0000000180e33eb4 _pthread_wqthread + 928
2   libsystem_pthread.dylib         0x0000000180e33b08 start_wqthread + 4

Thread 3:
0   libsystem_kernel.dylib          0x0000000180c95d84 __workq_kernreturn + 8
1   libsystem_pthread.dylib         0x0000000180e340a0 _pthread_wqthread + 1420
2   libsystem_pthread.dylib         0x0000000180e33b08 start_wqthread + 4

Thread 4:
0   libsystem_pthread.dylib         0x0000000180e33b04 start_wqthread + 0

Thread 5 name:  com.apple.uikit.eventfetch-thread
Thread 5:
0   libsystem_kernel.dylib          0x0000000180c73e08 mach_msg_trap + 8
1   libsystem_kernel.dylib          0x0000000180c73c80 mach_msg + 72
2   CoreFoundation                  0x00000001811b6e40 __CFRunLoopServiceMachPort + 196
3   CoreFoundation                  0x00000001811b4908 __CFRunLoopRun + 1568
4   CoreFoundation                  0x00000001810d4da8 CFRunLoopRunSpecific + 552
5   Foundation                      0x0000000181b49674 -[NSRunLoop+ 34420 (NSRunLoop) runMode:beforeDate:] + 304
6   Foundation                      0x0000000181b4951c -[NSRunLoop+ 34076 (NSRunLoop) runUntilDate:] + 148
7   UIKit                           0x000000018ad9a7e4 -[UIEventFetcher threadMain] + 136
8   Foundation                      0x0000000181c59efc __NSThread__start__ + 1040
9   libsystem_pthread.dylib         0x0000000180e35220 _pthread_body + 272
10  libsystem_pthread.dylib         0x0000000180e35110 _pthread_body + 0
11  libsystem_pthread.dylib         0x0000000180e33b10 thread_start + 4

Thread 6:
0   libsystem_pthread.dylib         0x0000000180e33b04 start_wqthread + 0

Thread 7 name:  RLMRealm notification listener
Thread 7:
0   libsystem_kernel.dylib          0x0000000180c7834c kevent + 8
1   Realm                           0x0000000100a05a80 realm::_impl::ExternalCommitHelper::listen() + 88704 (external_commit_helper.cpp:203)
2   Realm                           0x0000000100a063ec std::__1::__async_func<realm::_impl::ExternalCommitHelper::ExternalCommitHelper(realm::_impl::RealmCoordinator&)::$_0>::operator()() + 91116 (future:2323)
3   Realm                           0x0000000100a06374 std::__1::__async_assoc_state<void, std::__1::__async_func<realm::_impl::ExternalCommitHelper::ExternalCommitHelper(realm::_impl::RealmCoordinator&)::$_0> >::__execute() + 90996 (future:1041)
4   Realm                           0x0000000100a06524 std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (std::__1::__async_assoc_state<void, std::__1::__async_func<realm::_impl::ExternalCommitHelper::ExternalCommitHelper(realm::_impl::RealmCoordinator&)::$_0> >::*)(), std::__1::__async_assoc_state<void, std::__1::__async_func<realm::_impl::ExternalCommitHelper::ExternalCommitHelper(realm::_impl::RealmCoordinator&)::$_0> >*> >(void*, void*) + 91428 (thread:354)
5   libsystem_pthread.dylib         0x0000000180e35220 _pthread_body + 272
6   libsystem_pthread.dylib         0x0000000180e35110 _pthread_body + 0
7   libsystem_pthread.dylib         0x0000000180e33b10 thread_start + 4

Thread 8 name:  RLMRealm notification listener
Thread 8:
0   libsystem_kernel.dylib          0x0000000180c7834c kevent + 8
1   Realm                           0x0000000100a05a80 realm::_impl::ExternalCommitHelper::listen() + 88704 (external_commit_helper.cpp:203)
2   Realm                           0x0000000100a063ec std::__1::__async_func<realm::_impl::ExternalCommitHelper::ExternalCommitHelper(realm::_impl::RealmCoordinator&)::$_0>::operator()() + 91116 (future:2323)
3   Realm                           0x0000000100a06374 std::__1::__async_assoc_state<void, std::__1::__async_func<realm::_impl::ExternalCommitHelper::ExternalCommitHelper(realm::_impl::RealmCoordinator&)::$_0> >::__execute() + 90996 (future:1041)
4   Realm                           0x0000000100a06524 std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (std::__1::__async_assoc_state<void, std::__1::__async_func<realm::_impl::ExternalCommitHelper::ExternalCommitHelper(realm::_impl::RealmCoordinator&)::$_0> >::*)(), std::__1::__async_assoc_state<void, std::__1::__async_func<realm::_impl::ExternalCommitHelper::ExternalCommitHelper(realm::_impl::RealmCoordinator&)::$_0> >*> >(void*, void*) + 91428 (thread:354)
5   libsystem_pthread.dylib         0x0000000180e35220 _pthread_body + 272
6   libsystem_pthread.dylib         0x0000000180e35110 _pthread_body + 0
7   libsystem_pthread.dylib         0x0000000180e33b10 thread_start + 4

Thread 0 crashed with ARM Thread State (64-bit):
    x0: 0x00000001007cdd68   x1: 0x0000000000000301   x2: 0x0000000000000000   x3: 0x0000000000000000
    x4: 0x00000001007654a0   x5: 0x0000000000000011   x6: 0x0000000000000000   x7: 0x00000001c8041ce0
    x8: 0x0000000000000003   x9: 0x0000000000000301  x10: 0x0000000000000000  x11: 0x0000000000000000
   x12: 0x0000000000000001  x13: 0x0000000000000000  x14: 0x0000000000000000  x15: 0x0000000000000001
   x16: 0x0000000180b042b0  x17: 0x0000000000000000  x18: 0x0000000000000000  x19: 0x0000000000000000
   x20: 0x00000000ffffffff  x21: 0x00000001007cdd68  x22: 0x0000000000000303  x23: 0x0000000000000001
   x24: 0x0000000000000001  x25: 0x0000000101534280  x26: 0x0000000000000000  x27: 0x0000000000000001
   x28: 0x0000000000000001   fp: 0x000000016f9eb140   lr: 0x0000000180b04334
    sp: 0x000000016f9eb120   pc: 0x0000000180b03644 cpsr: 0x60000000

从第11行向上移动线程0是代码执行:

第11行:EditClassView.beginInit()

class EditClassView: MStackView {

    // Parent implementation does nothing
    override func beginInit() {

        // First time `title` is referenced. It's lazy, so it's initialized here
        title.text = clss.getTitle()

        // Crashes before here
        ...
    }
}

第10行:在title延迟初始化程序中初始化本地EditClassView.title's属性:

lazy private(set) var title: TextField = {

    let title = TF.manufacture(for: .allPurpose, with: TParams(textSize: 21, inputView: nil, placeholder: "Class Title"))

    // Crashes before here
    ...
}()

第9行:我认为这只是引用TextFieldFactory.manufacture(for:with:)引用,而不是函数本身的实际执行:

第8行:我不确定这是指什么。它似乎只是TextFieldFactory.TextFieldParams类型,因为这是TextFieldFactory.swift:13上的内容:

typealias TParams = TextFieldFactory.TextFieldParams

// Here is the definition    
class TextFieldParams {

    static let DEFAULT_TEXT: String? = nil
    static let DEFAULT_FONT_NAME = "poiretone-regular"
    static let DEFAULT_TEXT_SIZE = MEDIUM_TEXT_SIZE
    static let DEFAULT_TEXT_COLOR = UIColor.black
    static let DEFAULT_TINT_COLOR = UIColor.black
    static let DEFAULT_TEXT_ALIGNMENT = NSTextAlignment.center
    static let DEFAULT_USES_AUTORESIZING_MASK = true
    static let DEFAULT_INPUT_VIEW = TextFieldFactory.EMPTY_INPUT_VIEW
    static let DEFAULT_PLACEHOLDER: String? = nil
    static let DEFAULT_ADJUST_WIDTH_WITH_TEXT = false
    static let DEFAULT_MIN_WIDTH: CGFloat? = nil
    static let DEFAULT_MAX_WIDTH: CGFloat? = nil
    static let DEFAULT_EMPTY_WIDTH: CGFloat? = nil

    let text: String?
    let fontName: String
    let textSize: CGFloat
    let textColor: UIColor
    let tintColor: UIColor
    let textAlignment: NSTextAlignment
    let translatesAutoresizingMaskIntoConstraints: Bool
    let inputView: UIView?
    let placeholder: String?
    let adjustWidthWithText: Bool
    let minWidth: CGFloat?
    let maxWidth: CGFloat?
    let emptyWidth: CGFloat?

    var font: UIFont {   return UIFont(name: fontName, size: textSize)!   }

    init(text: String? = DEFAULT_TEXT,
         fontName: String = DEFAULT_FONT_NAME,
         textSize: CGFloat = DEFAULT_TEXT_SIZE,
         textColor: UIColor = DEFAULT_TEXT_COLOR,
         tintColor: UIColor = DEFAULT_TINT_COLOR,
         textAlignment: NSTextAlignment = DEFAULT_TEXT_ALIGNMENT,
         translatesAutoresizingMaskIntoConstraints: Bool = DEFAULT_USES_AUTORESIZING_MASK,
         inputView: UIView? = DEFAULT_INPUT_VIEW,
         placeholder: String? = DEFAULT_PLACEHOLDER,
         adjustWidthWithText: Bool = DEFAULT_ADJUST_WIDTH_WITH_TEXT,
         minWidth: CGFloat? = DEFAULT_MIN_WIDTH,
         maxWidth: CGFloat? = DEFAULT_MAX_WIDTH,
         emptyWidth: CGFloat? = DEFAULT_EMPTY_WIDTH
        ) {

        self.text = text
        self.fontName = fontName
        self.textSize = textSize
        self.textColor = textColor
        self.tintColor = tintColor
        self.textAlignment = textAlignment
        self.translatesAutoresizingMaskIntoConstraints = translatesAutoresizingMaskIntoConstraints
        self.inputView = inputView
        self.placeholder = placeholder
        self.adjustWidthWithText = adjustWidthWithText
        self.minWidth = minWidth
        self.maxWidth = maxWidth
        self.emptyWidth = emptyWidth
    }
}

现在我迷失了。第7行和第6行根本没有引用我的代码,所以我不确定它在做什么,但接下来你知道我的一个全局常量 - GRADEDISPLAY_MAX_WIDTH - 正在第5行初始化。请记住,它与EditClassView毫无关系,更不用说EditClassView.title

但是在我展示它的初始化之前,有一个链接。 GRADEDISPLAY_MAX_WIDTH中引用了TF.manufacture(for:with:),但您会看到该函数只是一个大的switch块,并且在我们应该执行的情况下未引用GRADEDISPLAY_MAX_WIDTH这很奇怪。如果你回头看第10行,你会看到相关的案例是.allPurpose,一直到函数的最后:

static func manufacture(for textFieldPurpose: TextFieldPurpose, with params: TextFieldParams = TextFieldParams()) -> TextField {

    switch textFieldPurpose {

    case .notifyingTimeField:

        var ntf = makeNotifyingFocusableTimeField(with: params as! NotifyingFocusableTimeFieldParams)
        ntf.frame.size.width = CGFloat.timeFieldWidth
        ntf.underline()

        return ntf

    case .timeField:

        var ftf = makeFocusableTimeField(with: params as! FocusableTimeFieldParams)
        ftf.frame.size.width = CGFloat.timeFieldWidth
        ftf.underline()

        return ftf

    case .gradingCategoryTitle:

        var tf = makeUnderlineTextField(with: UnderlineTextFieldParams(edgeInsets: UIEdgeInsetsMake(0, AC_TITLE_DEFAULT_SIDE_INSET, UnderlineLabel.DEFAULT_BOTTOM_INSET, AC_TITLE_DEFAULT_SIDE_INSET),
                                                                       text: params.text,
                                                                       textSize: LARGE_TEXT_SIZE,
                                                                       inputView: nil,
                                                                       adjustWidthWithText: true,
                                                                       maxWidth: params.maxWidth)
        )
        tf.underline()

        return tf

    case .whereTextField:

        var tf = makeUnderlineTextField(with: UnderlineTextFieldParams(inputView: nil,
                                                                       adjustWidthWithText: true,
                                                                       minWidth: WHERE_TEXTFIELD_MIN_WIDTH,
                                                                       maxWidth: params.maxWidth)
        )
        tf.underline()

        return tf

    case .notifyingDateField:

        var ndf = makeNotifyingFocusableDateField(with: params as! ContextualFocusableParams)
        ndf.frame.size.width = CGFloat.timeFieldWidth
        ndf.underline()

        return ndf

    case .percentTotalField, .percentEachField, .percentUnequalField, .pointsTotalField, .pointsEachField, .pointsUnequalField, .percentExamTotalField, .percentEachExamField, .percentFinalField, .pointsExamTotalField, .pointsEachExamField, .pointsFinalField:

        guard let params = params as? ContextualFocusableParams else {

            fatalError("A ContextualFocusableParams must be passed in order to manufacture a FocusableWeightField")
        }

        var f = makeFocusableWeightField(for: textFieldPurpose, with: ContextualFocusableParams(context: params.context,
                                                                                                adjustWidthWithText: true,
                                                                                                minWidth: CGFloat.timeFieldWidth)
        )
        f.underline()

        return f

    case .customTitleField:

        let edgeInsets = UIEdgeInsetsMake(0, CUSTOM_TITLE_SIDE_INSET, UnderlineLabel.DEFAULT_BOTTOM_INSET, CUSTOM_TITLE_SIDE_INSET)
        var tf = makeUnderlineTextField(with: UnderlineTextFieldParams(edgeInsets: edgeInsets,
                                                                       inputView: nil,
                                                                       placeholder: params.placeholder,
                                                                       adjustWidthWithText: true,
                                                                       minWidth: params.minWidth,
                                                                       maxWidth: params.maxWidth,
                                                                       emptyWidth: params.emptyWidth)
        )
        tf.underline()

        return tf

    case .gradeField:

        let tf = initializedTextField(textField: PercentSuffixedTextField(),
                                      params: TParams(text: params.text,
                                                      textSize: AV_GRADE_TEXT_SIZE,
                                                      textColor: UIColor.defaultTextColor,
                                                      inputView: nil)
        )
        tf.frame.size = CGSize(width: GRADEDISPLAY_MAX_WIDTH, height: GV_HEIGHT)
        tf.isEnabled = false
        tf.keyboardType = .numberPad

        return tf

    case .fractionField:

        let tf = makeTextField(with: TParams(text: params.text,
                                             textSize: AV_GRADE_TEXT_SIZE,
                                             textColor: UIColor.defaultTextColor,
                                             inputView: nil)
        )
        tf.frame.size.width = GRADEDISPLAY_MAX_WIDTH
        tf.isEnabled = false
        tf.keyboardType = .numberPad

        return tf

    case .assessmentTitle:

        let tf = makeTextField(with: TParams(text: params.text,
                                             textSize: AV_TITLE_TEXT_SIZE,
                                             textColor: UIColor.defaultTextColor,
                                             placeholder: String.classTitlePlaceholder,
                                             adjustWidthWithText: true)
        )
        tf.isEnabled = false

        return tf

    case .weightField:

        let tf = initializedTextField(textField: PercentSuffixedTextField(adjustWidthWithText: true, minWidth: params.minWidth),
                                      params: TParams(text: params.text,
                                                      textSize: params.textSize,
                                                      textAlignment: .right,
                                                      inputView: nil)
        )
        tf.keyboardType = .decimalPad
        tf.performableActions = []

        return tf

    // `GRADEDISPLAY_MAX_WIDTH` is referenced in the `.gradeField` 
    // and `.fractionField` cases just above here
    case .allPurpose: return makeTextField(with: params)

    case .allPurposeInsetting: return makeInsetTextField(with: params as! ITParams)
    }
}

第5行:我认为这是GRADEDISPLAY_MAX_WIDTH的初始化,因为DimensionConstants.swift:220是其属性定义开始的地方

let GRADEDISPLAY_MAX_WIDTH: CGFloat = {

    let gradeField = TF.manufacture(for: .allPurpose, with: TParams(text: "100%", textSize: 17))

    // From the look of the crash report, it doesn't look 
    // like execution makes it this far
    let trailingMargin: CGFloat = 4

    return proportionedWidth(gradeField.frame.size.width + trailingMargin)
}()

我不确定第4行是指什么。可能是GRADEDISPLAY_MAX_WIDTH本身吗?

最后是崩溃报告中对我的代码的最后一次引用。

第3行:它看起来与第8行相同......

这里的优先事项是修复崩溃,我认为它与堆栈跟踪的第6行和第7行发生的事情有关。我可以进入我的代码库,但请相信我GRADEDISPLAY_MAX_WIDTH未在EditClassView中的任何地方引用它或任何与之相关的代码,因此没有理由在远处附近看到它任何堆栈跟踪中的EditClassView

任何人都可以了解第6和第7行的情况吗?

这可能是另一条线索:

引用线程0中的第36行PercentBasedUnequalField;特别是第12行。 PercentBasedUnequalField实际上并未在应用程序的执行代码中的任何位置使用。这是我正在努力的新功能的一部分。我将文件保留在捆绑包中,因为删除它会很麻烦,因为当前的源分支分支了那个不完整的功能。

此处的相似性与GRADEDISPLAY_MAX_WIDTH类似,PercentBasedUnequalField中的switch案例中也引用了TF.manufacture(for:with:)

更新

找到this similar issue,其中海报显示cases语句的所有switch正在作为快速优化执行。这可以解释为什么GRADEDISPLAY_MAX_WIDTH被初始化,即使访问它的case不匹配。我将尝试添加链接中提到的优化禁用注释,并在修复问题时进行更新。

1 个答案:

答案 0 :(得分:0)

显然,swift正在进行的一次编译时优化导致cases语句中的所有switch被执行,而不管匹配的模式如何。这导致我的一个全局常量被初始化导致它第一次被访问的地方,如果我正确地解释了Application Specific Information,这会导致一些递归。崩溃报告:

  

在LIBDISPATCH的客户端BUG:试图递归锁定

我通过将Target - &gt;中的版本的优化级别设置为无来解决问题。 Build Settings - &gt; Swift Compiler - Code Generation - &gt; Optimization Level - &gt; Release

因此,最终发布和调试的设置为-Onone

相关问题