Crash on MacOS(M1 series): uncaught exception 'NSInternalInconsistencyException', reason:Invalid parameter not satisfying: <SPRoundedWindow: 0x139fbbab0>. "frame=!CGRectIsNull(frame)

Question: I downloaded and run the iOS application on a laptop with M1 processor

System Info: macOS Montery 12.0.1,MacBook Pro (13-inch, M1, 2020)

Steps to reproduce: Click any TextField, and then click the input box in WKWebView

Prerequisite: Clear the cache and start the App for the first time

The crash log is as follows:

2021-12-31 18:55:31.930622+0800 TestMacPro[57297:1269799] [default] could not create original path for node <FSNode 0x60000247e600> { isDir = ?, path = '/private/var/folders/rv/139v0xg52q59r657bxbsrbfc0000gp/X/82BBDE53-4B58-5C54-A1A4-90827962856E/d/Wrapper/TestMacPro.app' }, proceeding: Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"
2021-12-31 18:55:32.074604+0800 TestMacPro[57297:1269799] Metal API Validation Enabled
2021-12-31 18:55:34.021293+0800 TestMacPro[57297:1269799] IOMFB: FigInstallVirtualDisplay not found
2021-12-31 18:55:34.021423+0800 TestMacPro[57297:1269799] iomfb_match_callback: primary
2021-12-31 18:55:34.021476+0800 TestMacPro[57297:1269799] iomfb_match_callback: external-0
2021-12-31 18:55:41.502881+0800 TestMacPro[57297:1269799] *** Assertion failure in void _NSWindowSetFrameIvar(NSWindow *, NSRect)(), NSWindow.m:932
2021-12-31 18:55:41.538942+0800 TestMacPro[57297:1269799] [General] An uncaught exception was raised
2021-12-31 18:55:41.539041+0800 TestMacPro[57297:1269799] [General] Invalid parameter not satisfying: <SPRoundedWindow: 0x139fbbab0>. "frame=!CGRectIsNull(frame)"
2021-12-31 18:55:41.539130+0800 TestMacPro[57297:1269799] [General] (
	0  CoreFoundation           0x00000001882f812c __exceptionPreprocess + 240
	1  libobjc.A.dylib           0x0000000188049808 objc_exception_throw + 60
	2  Foundation             0x000000018926ae20 -[NSMutableDictionary(NSMutableDictionary) initWithContentsOfFile:] + 0
	3  AppKit               0x000000018ae1ffbc -[NSWindow _reallySetFrame:] + 904
	4  AppKit               0x000000018ae1f874 -[NSWindow _oldPlaceWindow:fromServer:] + 228
	5  AppKit               0x000000018ae1e894 -[NSWindow _setFrameCommon:display:fromServer:] + 2200
	6  SafariPlatformSupport        0x00000001ae618104 __85-[SPSafariPlatformSupport displayOTPAutoFillRelativeToRect:ofView:completionHandler:]_block_invoke + 300
	7  SafariPlatformSupport        0x00000001ae617f8c -[SPSafariPlatformSupport displayOTPAutoFillRelativeToRect:ofView:completionHandler:] + 228
	8  UIKitCore              0x00000001b00d6334 -[UIKeyboardImpl generateAutofillCandidateByAddingTask:] + 948
	9  UIKitCore              0x00000001b00e03fc -[UIKeyboardImpl setDelegate:force:] + 6248
	10 UIKitCore              0x00000001afdc62f4 -[UIKeyboardSceneDelegate _reloadInputViewsForKeyWindowSceneResponder:] + 2080
	11 UIKitCore              0x00000001afdc5aa8 -[UIKeyboardSceneDelegate _reloadInputViewsForResponder:] + 164
	12 UIKitCore              0x00000001af7394d8 -[UIResponder(UIResponderInputViewAdditions) reloadInputViews] + 132
	13 WebKit               0x00000001c102447c -[WKContentView(WKInteraction) _elementDidFocus:userIsInteracting:blurPreviousNode:activityStateChanges:userObject:] + 2088
	14 WebKit               0x00000001c0d354d4 _ZN6WebKit12WebPageProxy15elementDidFocusERKNS_25FocusedElementInformationEbbN3***9OptionSetIN7WebCore13ActivityState4FlagEEERKNS_8UserDataE + 216
	15 WebKit               0x00000001c0f9bee8 _ZN6WebKit12WebPageProxy17didReceiveMessageERN3IPC10ConnectionERNS1_7DecoderE + 61312
	16 WebKit               0x00000001c0993e24 _ZN3IPC18MessageReceiverMap15dispatchMessageERNS_10ConnectionERNS_7DecoderE + 272
	17 WebKit               0x00000001c0d041e8 _ZN6WebKit15WebProcessProxy17didReceiveMessageERN3IPC10ConnectionERNS1_7DecoderE + 40
	18 WebKit               0x00000001c09763e0 _ZN3IPC10Connection15dispatchMessageENSt3__110unique_ptrINS_7DecoderENS1_14default_deleteIS3_EEEE + 808
	19 WebKit               0x00000001c09759f0 _ZN3IPC10Connection24dispatchIncomingMessagesEv + 508
	20 JavaScriptCore           0x00000001bfef8a40 _ZN3***7RunLoop11performWorkEv + 292
	21 JavaScriptCore           0x00000001bfef9bb0 _ZN3***7RunLoop11performWorkEPv + 36
	22 CoreFoundation           0x0000000188278bbc __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28
	23 CoreFoundation           0x0000000188278b08 __CFRunLoopDoSource0 + 208
	24 CoreFoundation           0x00000001882787f4 __CFRunLoopDoSources0 + 268
	25 CoreFoundation           0x0000000188277168 __CFRunLoopRun + 820
	26 CoreFoundation           0x0000000188276694 CFRunLoopRunSpecific + 600
	27 HIToolbox              0x0000000190dec990 RunCurrentEventLoopInMode + 292
	28 HIToolbox              0x0000000190dec704 ReceiveNextEventCommon + 552
	29 HIToolbox              0x0000000190dec4c4 _BlockUntilNextEventMatchingListInModeWithFilter + 72
	30 AppKit               0x000000018adcbaec _DPSNextEvent + 844
	31 AppKit               0x000000018adca390 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1332
	32 AppKit               0x000000018adbc3b0 -[NSApplication run] + 596
	33 AppKit               0x000000018ad8da84 NSApplicationMain + 1064
	34 AppKit               0x000000018b063ff0 +[NSWindow _savedFrameFromString:] + 0
	35 UIKitMacHelper           0x000000019d764484 UINSApplicationMain + 1280
	36 UIKitCore              0x00000001af5b2ce4 UIApplicationMain + 164
	37 TestMacPro             0x0000000100d15bb4 main + 128
	38 dyld                0x000000010102d0f4 start + 520
)
(lldb) 

Accepted Reply

After looking at Caleb Jones's comment, I found that disabling autocorrection on the textfield in swiftui stops crashes entirely.

The main issue is probably because MacCatalyst doesn't support predictive text, but iOS/iPadOS does due to the virtual keyboard. Disabling autocorrection disables predictive text.

Here's my code with the fix:

import SwiftUI
import WebKit

struct ContentView: View {
  @State var textObject: String = ""
   
  var body: some View {
    ZStack {
      WebView(url: URL(string: "https://google.com")!)
       
         
      TextField("", text: $textObject)
        .background(
          Rectangle()
            .foregroundColor(.black)
        )
        .disableAutocorrection(true)
    }
  }
}

struct WebView: UIViewRepresentable {   
  var url: URL
 
  func makeUIView(context: Context) -> WKWebView {
    return WKWebView()
  }
 
  func updateUIView(_ webView: WKWebView, context: Context) {
    let request = URLRequest(url: url)
    webView.load(request)
  }
}
  • Thanks!

  • it does not works for me

  • quote

Add a Comment

Replies

This is the top crash for our macOS application. The workaround of disabling auto-correct does not seem to resolve the crash completely in our case. Have there been any updates on submitted bug reports?