Xcode - is it possible to debug crashes in the Interface Builder's Live Rendering process (IBDesignable)?

后端 未结 2 784
醉梦人生
醉梦人生 2021-02-01 18:17

Question

Is it possible to set breakpoints and debug code executed by Xcode / Interface Builder\'s Live Rendering? That is, I am using the IBDesignable

2条回答
  •  囚心锁ツ
    2021-02-01 18:38

    (tools note: Xcode 8.2, macOS Sierra)

    I had a very different failure than yours: I had a crash in code that resulted in an IB error in Xcode:

    error: IB Designables: Failed to update auto layout status: The agent crashed

    To debug this on macOS Sierra, open Console.app, and open "User Reports" in the right sidebar. Find the "IBDesignablesCocoaTouch*" crashes, and select the applicable one. This gave me the code-level info I needed to diagnose it.

    Crashed Thread:        0
    
    Exception Type:        EXC_BAD_INSTRUCTION (SIGILL)
    Exception Codes:       0x0000000000000001, 0x0000000000000000
    Exception Note:        EXC_CORPSE_NOTIFY
    
    Termination Signal:    Illegal instruction: 4
    Termination Reason:    Namespace SIGNAL, Code 0x4
    Terminating Process:   exc handler [0]
    
    Application Specific Information:
    CoreSimulator 375.21 - Device: IBSimDeviceTypeiPad2x - Runtime: iOS 10.3 (14E8301) - DeviceType: IBSimDeviceTypeiPad2x
    
    Thread 0 Crashed:
    0   libswiftUIKit.dylib             0x000000021a2ddead _TToFE5UIKitCSo7UIImagecfT24imageLiteralResourceNameSS_S0_ + 205
    1   libswiftUIKit.dylib             0x000000021a2ddcef _TFE5UIKitCSo7UIImageCfT24imageLiteralResourceNameSS_S0_ + 79
    2   com.company.App         0x0000000216df74ad _TZFC10App21ControlsP33_F7118662B6663018C7DD0DEBB6FDD87511buttonImagefT8forStateOS_25State_CSo7UIImage + 109 (Controls.swift:121)
    …
    

    (In my case, Interface Builder was failing to load an image literal. I had to implement this workaround: xcode 6 IB_DESIGNABLE- not loading resources from bundle in Interface builder)

提交回复
热议问题