Jiwift

[iOS/Swift] Xcode WebKit Build Crash 해결 본문

iOS Dev/Xcode

[iOS/Swift] Xcode WebKit Build Crash 해결

지위프트 2024. 5. 29. 10:48
반응형

Xcode에서 빌드 후 앱이 실행되는 순간에 WebKit에서 에러가 발생하는 문제를 해결 

 

 

상황: iOS 프로젝트에서 WebKit을 사용 중입니다. Xcode에서 테스트를 위해 빌드하면 코드 실행 중 Crash가 발생합니다.  

Error: Thread 1: EXC_BREAKPOINT (code=1, subcode=0x19e88fa18)

 

 기존 iOS 16.x대에서는 문제가 없던 것 같은데 17.x 버전들이 문제가 발생했습니다. 로직도 아닌 애플에서 제공해 주는 기본 코드들도 문제였습니다

 

 아래는 에러가 났던 코드들입니다. 다른 곳에서 더 있을 수 있어요.

WKWebsiteDataStore.default()
            .fetchDataRecords(ofTypes: WKWebsiteDataStore.allWebsiteDataTypes()) { records in
                records
                    .forEach {
                        WKWebsiteDataStore.default()
                            .removeData(ofTypes: $0.dataTypes,
                                        for: [$0],
                                        completionHandler: {})
                    }
            }
let webConfiguration = WKWebViewConfiguration()
webConfiguration.preferences.javaScriptCanOpenWindowsAutomatically = true

 

해결 방법은 Xcode에서 설정을 변경하면 됩니다. 

 

Edit Scheme -> Run -> Diagnostics로 이동합니다. 

 

여기서 "Malloc Scribble"을 체크해제해 주세요. 만약 그래도 안된다면 "Malloc Stack Logging"도 체크를 해제해 보세요. 

 

제가 보기엔 Xcode 버그로 보이지만 이런 식으로 임시 해결을 진행하는 게 현재 최선으로 보입니다. 

 

 

 

 

swift - iOS 17.5.1 Xcode WebKit Crash - Stack Overflow

 

iOS 17.5.1 Xcode WebKit Crash

iOS 17.5.1 Xcode WebKit Crash Hello, I have two iPhone devices that I have. These devices are iOS17.5.1, and all Wk related codes cause Crash. Crash occurs when Xcode Build is complete and the app is

stackoverflow.com

 

Crash on [WKWebView initWithFrame:… | Apple Developer Forums

 

Crash on [WKWebView initWithFrame:… | Apple Developer Forums

I experience the same issue. It was fine on Xcode 15.0. And I need to disable Malloc Scribble in Xcode 15.3, otherwise I just can't run Debug build.

developer.apple.com

 

 

 

반응형