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

my app has encountered the same crash issue

The crash log is as follows:

Please post a full Apple crash report. For advice on how to do that, see Posting a Crash Report.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

[AndyLi sent me a crash report via email.]

The presence of this:

Last Exception Backtrace:

indicates that the app crashed due to an unhandled language exception. The backtrace looks like this:

0   com.apple.CoreFoundation       … __exceptionPreprocess + 220 …
1   libobjc.A.dylib                … objc_exception_throw + 60 …
2   com.apple.Foundation           … -[NSMutableDictionary(NSMutableDictionary) initWithContentsOfFile:]
3   com.apple.AppKit               … -[NSWindow _reallySetFrame:] + 904 …
4   com.apple.AppKit               … -[NSWindow _oldPlaceWindow:fromServer:] + 228 …
5   com.apple.AppKit               … -[NSWindow _setFrameCommon:display:fromServer:] + 2200 …
6   com.apple.SafariPlatformSupport… __85-[SPSafariPlatformSupport displayOTPAutoFillRelativeToRect:ofView:completionHandler:]_block_invoke + 300 …
7   com.apple.SafariPlatformSupport… -[SPSafariPlatformSupport displayOTPAutoFillRelativeToRect:ofView:completionHandler:] + 228 …
8   com.apple.UIKitCore            … -[UIKeyboardImpl generateAutofillCandidateByAddingTask:] + 948 …
9   com.apple.UIKitCore            … -[UIKeyboardImpl setDelegate:force:] + 6248 …
10  com.apple.UIKitCore            … -[UIKeyboardSceneDelegate _reloadInputViewsForKeyWindowSceneResponder:] + 2080 …
11  com.apple.UIKitCore            … -[UIKeyboardSceneDelegate _reloadInputViewsForResponder:] + 164 …
12  com.apple.UIKitCore            … -[UIResponder(UIResponderInputViewAdditions) reloadInputViews] + 132 …
13  com.apple.WebKit               … -[WKContentView(WKInteraction) _elementDidFocus:userIsInteracting:blurPreviousNode:activityStateChanges:userObject:] + 2088 …
14  com.apple.WebKit               … WebKit::WebPageProxy::elementDidFocus(WebKit::FocusedElementInformation const&, bool, bool, ***::OptionSet<WebCore::ActivityState::Flag>, WebKit::UserData const&) + 216 …
15  com.apple.WebKit               … WebKit::WebPageProxy::didReceiveMessage(IPC::Connection&, IPC::Decoder&) + 61312 …
16  com.apple.WebKit               … IPC::MessageReceiverMap::dispatchMessage(IPC::Connection&, IPC::Decoder&) + 272 …
17  com.apple.WebKit               … WebKit::WebProcessProxy::didReceiveMessage(IPC::Connection&, IPC::Decoder&) + 40 …
18  com.apple.WebKit               … IPC::Connection::dispatchMessage(std::__1::unique_ptr<IPC::Decoder, std::__1::default_delete<IPC::Decoder> >) + 808 …
19  com.apple.WebKit               … IPC::Connection::dispatchIncomingMessages() + 508 …
20  com.apple.JavaScriptCore       … ***::RunLoop::performWork() + 292 …
21  com.apple.JavaScriptCore       … ***::RunLoop::performWork(void*) + 36 …
22  com.apple.CoreFoundation       … __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28 …
23  com.apple.CoreFoundation       … __CFRunLoopDoSource0 + 208 …
24  com.apple.CoreFoundation       … __CFRunLoopDoSources0 + 268 …
25  com.apple.CoreFoundation       … __CFRunLoopRun + 820 …
26  com.apple.CoreFoundation       … CFRunLoopRunSpecific + 600 …
27  com.apple.HIToolbox            … RunCurrentEventLoopInMode + 292 …
28  com.apple.HIToolbox            … ReceiveNextEventCommon + 552 …
29  com.apple.HIToolbox            … _BlockUntilNextEventMatchingListInModeWithFilter + 72 …
30  com.apple.AppKit               … _DPSNextEvent + 844 …
31  com.apple.AppKit               … -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1332 …
32  com.apple.AppKit               … -[NSApplication run] + 596 …
33  com.apple.AppKit               … NSApplicationMain + 1064 …
34  com.apple.AppKit               … +[NSWindow _savedFrameFromString:] + 24 …
35  com.apple.UIKitMacHelper       … UINSApplicationMain + 1280 …
36  com.apple.UIKitCore            … UIApplicationMain + 164 …
37  cn.fayne.testMacAppCrash       … main
38  dyld                           … start + 520 …

Frames 38 through 22 are typical of any app. Frames 21 through 15 indicate that the app is handling an event coming in from the WebKit helper process. Frame 14 suggests that this is a focus changed event. Frame 8 suggests that this is a credential field and UIKit is looking for password autofill suggestions. Frames 7 and 6 suggests that this field is in the web view itself. Which brings us to the exception text:

AppKit: Crashing on exception: Invalid parameter not satisfying: <SPRoundedWindow: 0x14076d660>. "frame=!CGRectIsNull(frame)"

In this case SPRoundedWindow is something coming from com.apple.SafariPlatformSupport. So, there’s a WebKit window with a credential field that’s receiving a focus event which is dying in AppKit because of a problem with the window frame.

Based on the name in this crash report, TestMacPro, it sounds like you can reliably reproduce the crash with a small test app. Is that right?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

  • Yes, I can reproduce this crash. The test app is similar to kingbri 's reply

Add a Comment

Hi there, I am also having the same problem with my MacCatalyst app on MacOS monterey 12.1 (13-inch 2021 M1 MBP)

Error message: libc++abi: terminating with uncaught exception of type NSException *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: <SPRoundedWindow: 0x126774250>. "frame=!CGRectIsNull(frame)"' terminating with uncaught exception of type NSException

I was able to create a test app which reproduces the crash every time. Here's the code for it (SwiftUI).

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)
        )
    }
  }
}

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)
  }
}

To reproduce the crash:

  1. Launch the app on a mac
  2. Click in the textfield
  3. Click on the google search bar
  4. The crash should occur

The same issue also silently occurs when running the app in rosetta but the app doesn't terminate.

Here's my crash log down below:

0   CoreFoundation                      0x00000001848001cc __exceptionPreprocess + 240
1   libobjc.A.dylib                     0x00000001845517b8 objc_exception_throw + 60
2   Foundation                          0x000000018576e840 -[NSMutableDictionary(NSMutableDictionary) initWithContentsOfFile:] + 0
3   AppKit                              0x0000000187328f20 -[NSWindow _reallySetFrame:] + 904
4   AppKit                              0x00000001873287d8 -[NSWindow _oldPlaceWindow:fromServer:] + 228
5   AppKit                              0x00000001873277f8 -[NSWindow _setFrameCommon:display:fromServer:] + 2200
6   SafariPlatformSupport               0x00000001aac63104 __85-[SPSafariPlatformSupport displayOTPAutoFillRelativeToRect:ofView:completionHandler:]_block_invoke + 300
7   SafariPlatformSupport               0x00000001aac62f8c -[SPSafariPlatformSupport displayOTPAutoFillRelativeToRect:ofView:completionHandler:] + 228
8   UIKitCore                           0x00000001ac7317a0 -[UIKeyboardImpl generateAutofillCandidateByAddingTask:] + 948
9   UIKitCore                           0x00000001ac73b8d0 -[UIKeyboardImpl setDelegate:force:] + 6248
10  UIKitCore                           0x00000001ac41fad4 -[UIKeyboardSceneDelegate _reloadInputViewsForKeyWindowSceneResponder:] + 2080
11  UIKitCore                           0x00000001ac41f288 -[UIKeyboardSceneDelegate _reloadInputViewsForResponder:] + 164
12  UIKitCore                           0x00000001abd918a0 -[UIResponder(UIResponderInputViewAdditions) reloadInputViews] + 132
13  UIKitCore                           0x00000001abd3a298 -[UIResponder becomeFirstResponder] + 856
14  UIKit                               0x0000000202830aa4 -[UITextInputUIResponderAccessibility becomeFirstResponder] + 52
15  UIKitCore                           0x00000001abd6a100 -[UIView(Hierarchy) becomeFirstResponder] + 176
16  WebKit                              0x00000001bd66c5c0 -[WKContentView(WKInteraction) becomeFirstResponderForWebView] + 152
17  WebKit                              0x00000001bd246768 -[WKWebView(WKViewInternalIOS) becomeFirstResponder] + 148
18  WebKit                              0x00000001bd67f88c -[WKContentView(WKInteraction) _elementDidFocus:userIsInteracting:blurPreviousNode:activityStateChanges:userObject:] + 1840
19  WebKit                              0x00000001bd381ea0 _ZN6WebKit12WebPageProxy15elementDidFocusERKNS_25FocusedElementInformationEbbN3***9OptionSetIN7WebCore13ActivityState4FlagEEERKNS_8UserDataE + 216
20  WebKit                              0x00000001bd5f66b8 _ZN6WebKit12WebPageProxy17didReceiveMessageERN3IPC10ConnectionERNS1_7DecoderE + 61472
21  WebKit                              0x00000001bcfcc5cc _ZN3IPC18MessageReceiverMap15dispatchMessageERNS_10ConnectionERNS_7DecoderE + 272
22  WebKit                              0x00000001bd35a284 _ZN6WebKit15WebProcessProxy17didReceiveMessageERN3IPC10ConnectionERNS1_7DecoderE + 40
23  WebKit                              0x00000001bcfaeb4c _ZN3IPC10Connection15dispatchMessageENSt3__110unique_ptrINS_7DecoderENS1_14default_deleteIS3_EEEE + 808
24  WebKit                              0x00000001bcfae15c _ZN3IPC10Connection24dispatchIncomingMessagesEv + 508
25  JavaScriptCore                      0x00000001bc5278d0 _ZN3***7RunLoop11performWorkEv + 292
26  JavaScriptCore                      0x00000001bc528a40 _ZN3***7RunLoop11performWorkEPv + 36
27  CoreFoundation                      0x0000000184780c5c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28
28  CoreFoundation                      0x0000000184780ba8 __CFRunLoopDoSource0 + 208
29  CoreFoundation                      0x0000000184780894 __CFRunLoopDoSources0 + 268
30  CoreFoundation                      0x000000018477f208 __CFRunLoopRun + 820
31  CoreFoundation                      0x000000018477e734 CFRunLoopRunSpecific + 600
32  HIToolbox                           0x000000018d310f68 RunCurrentEventLoopInMode + 292
33  HIToolbox                           0x000000018d310cdc ReceiveNextEventCommon + 552
34  HIToolbox                           0x000000018d310a9c _BlockUntilNextEventMatchingListInModeWithFilter + 72
35  AppKit                              0x00000001872d4ce0 _DPSNextEvent + 844
36  AppKit                              0x00000001872d3584 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1332
37  AppKit                              0x00000001872c55a4 -[NSApplication run] + 596
38  AppKit                              0x0000000187296c78 NSApplicationMain + 1064
39  AppKit                              0x000000018756d084 +[NSWindow _savedFrameFromString:] + 0
40  UIKitMacHelper                      0x0000000199c7d9ac UINSApplicationMain + 1280
41  UIKitCore                           0x00000001abc0ab28 UIApplicationMain + 164
42  SwiftUI                             0x00000001c0fce8b0 $s7SwiftUI17KitRendererCommon33_ACC2C5639A7D76F611E170E831FCA491LLys5NeverOyXlXpFAESpySpys4Int8VGSgGXEfU_ + 164
43  SwiftUI                             0x00000001c0fce808 $s7SwiftUI6runAppys5NeverOxAA0D0RzlF + 252
44  SwiftUI                             0x00000001c08f54cc $s7SwiftUI3AppPAAE4mainyyFZ + 128
45  TestingGround                       0x000000010056d634 $s13TestingGround0aB3AppV5$mainyyFZ + 40
46  TestingGround                       0x000000010056d6d4 main + 12
47  dyld                                0x00000001015a50f4 start + 520
  • I'm not sure what's going on here or how to fix this crash. Is this an internal bug?

Add a Comment

I am also having the same problem with my iOS app on MacOS monterey 12.1

Jinhao wrote:

I can reproduce this crash.

kingbri wrote:

I was able to create a test app which reproduces the crash every time.

OK then. Given how simple that code is, it’s hard to imagine it being anything other than a bug on Apple’s side. I encourage you to file a bug report about this, attaching your simple test project and a description of the steps you used to reproduce it.

Please post your bug number, just for the record.

As to workarounds, mixing SwiftUI and WebKit is largely outside of my area of expertise, so I can’t help you on that front (I mostly focus on low-level stuff, not UI stuff :-). If no one else chimes in here my advice is that you open a DTS tech support incident to get help from one of DTS’s ‘UI stuff’ specialists.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

  • bug number: FB9834719

  • FB9835055 has been filed

  • Thanks to you both.

Add a Comment

I'd definitely appreciate an update if anyone finds a workaround for this. I've been banging my head against the wall for quite a bit. Thanks!

  • I've filed a DTS request, so we'll see what they say

  • Thanks!

  • Well, in case it helps anyone I think I found a workaround. I'm using Storyboards and set all the textfields' Content Type to unspecified and the crashing has stopped. Unfortunately, I tried adding .textContentType(.none) to the TextField in kingbri's SwiftUI example, though, and its still crashing.

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

it does not works for me, but sometimes useful.

Hi,

Disabling auto-correction on SwiftUI TextFields by using .disableAutocorrection(true) did not affect the occurence of this bug for me.

I am experiencing this bug at an alarmingly regular basis, specifically on macOS Monterey. This bug did not occur for me on previous versions of macOS.

Notably, the bug seems to be caused mainly when SwiftUI .sheet() or .alert() views are dismissed.

I am indeed building a Mac Catalyst app that uses a WKWebView, similarly to others above.

I think that this is a bug from Apple's side, introduced in macOS Monterey, and that Apple needs to fix. I have been unable to meaningfully diagnose this bug but I am certain that nothing in my code can reasonably be assigned the blame.

I would very much appreciate insight into how to fix this bug once and for all. It's making my Mac Catalyst app borderline unusable on macOS Monterey.

I found the main reason that caused this crash.

I debug it on my MacbookPro M1 Max which reproduced the crash every time

For UITextFiled, If you set keyboardType to UIKeyboardTypeNumberPad or UIKeyboardTypePhonePad or UIKeyboardTypeASCIICapableNumberPad, it will be crashed.

Usually, in condition of specific business function, we can`t set keyboardType to other type in order to avoid crash.

So, hope one day ,Apple can fix it as soon as possile.

typedef NS_ENUM(NSInteger, UIKeyboardType) {
    UIKeyboardTypeDefault,                
    UIKeyboardTypeASCIICapable,          
    UIKeyboardTypeNumbersAndPunctuation,  
    UIKeyboardTypeURL,                   
    UIKeyboardTypeNumberPad,              // crash
    UIKeyboardTypePhonePad,               // crash
    UIKeyboardTypeNamePhonePad,          
    UIKeyboardTypeEmailAddress,          
    UIKeyboardTypeDecimalPad API_AVAILABLE(ios(4.1)),   
    UIKeyboardTypeTwitter API_AVAILABLE(ios(5.0)),      
    UIKeyboardTypeWebSearch API_AVAILABLE(ios(7.0)),    
    UIKeyboardTypeASCIICapableNumberPad API_AVAILABLE(ios(10.0)),  // crash
    UIKeyboardTypeAlphabet = UIKeyboardTypeASCIICapable, 
};
  • I am not setting keyboardTypes on UITextField and am still experiencing this crash. Unless SwiftUI somehow does this automatically...

Add a Comment

Same issue, regardless if I run the app as 'catalyst' or 'designed for ipad on m1'. The crash occurs whenever I click on an input field in the webview, so I'm unable to control the keyboard type...which currently renders the app completely unusable, as I can't seem to find a workaround

0   CoreFoundation                      0x00000001a2df81cc __exceptionPreprocess + 240
	1   libobjc.A.dylib                     0x00000001a2b497b8 objc_exception_throw + 60
	2   Foundation                          0x00000001a3d66840 -[NSMutableDictionary(NSMutableDictionary) initWithContentsOfFile:] + 0
	3   AppKit                              0x00000001a5921240 -[NSWindow _reallySetFrame:] + 904
	4   AppKit                              0x00000001a5920af8 -[NSWindow _oldPlaceWindow:fromServer:] + 228
	5   AppKit                              0x00000001a591fb18 -[NSWindow _setFrameCommon:display:fromServer:] + 2200
	6   SafariPlatformSupport               0x00000001c9297104 __85-[SPSafariPlatformSupport displayOTPAutoFillRelativeToRect:ofView:completionHandler:]_block_invoke + 300
	7   SafariPlatformSupport               0x00000001c9296f8c -[SPSafariPlatformSupport displayOTPAutoFillRelativeToRect:ofView:completionHandler:] + 228
	8   UIKitCore                           0x00000001cad67298 -[UIKeyboardImpl generateAutofillCandidateByAddingTask:] + 948
	9   UIKitCore                           0x00000001cad713c8 -[UIKeyboardImpl setDelegate:force:] + 6248
	10  UIKitCore                           0x00000001caa54878 -[UIKeyboardSceneDelegate _reloadInputViewsForKeyWindowSceneResponder:] + 2080
	11  UIKitCore                           0x00000001caa5402c -[UIKeyboardSceneDelegate _reloadInputViewsForResponder:] + 164
	12  UIKitCore                           0x00000001ca3c662c -[UIResponder(UIResponderInputViewAdditions) reloadInputViews] + 132
	13  WebKit                              0x00000001dbcba3b4 -[WKContentView(WKInteraction) _elementDidFocus:userIsInteracting:blurPreviousNode:activityStateChanges:userObject:] + 2088
	14  WebKit                              0x00000001db9bbcec _ZN6WebKit12WebPageProxy15elementDidFocusERKNS_25FocusedElementInformationEbbN3***9OptionSetIN7WebCore13ActivityState4FlagEEERKNS_8UserDataE + 216
	15  WebKit                              0x00000001dbc30bf4 _ZN6WebKit12WebPageProxy17didReceiveMessageERN3IPC10ConnectionERNS1_7DecoderE + 61512
	16  WebKit                              0x00000001db6052a8 _ZN3IPC18MessageReceiverMap15dispatchMessageERNS_10ConnectionERNS_7DecoderE + 272
	17  WebKit                              0x00000001db98ccf0 _ZN6WebKit15WebProcessProxy17didReceiveMessageERN3IPC10ConnectionERNS1_7DecoderE + 40
	18  WebKit                              0x00000001db5e77fc _ZN3IPC10Connection15dispatchMessageENSt3__110unique_ptrINS_7DecoderENS1_14default_deleteIS3_EEEE + 808
	19  WebKit                              0x00000001db5e6e0c _ZN3IPC10Connection24dispatchIncomingMessagesEv + 508
	20  JavaScriptCore                      0x00000001dab60710 _ZN3***7RunLoop11performWorkEv + 292
	21  JavaScriptCore                      0x00000001dab61880 _ZN3***7RunLoop11performWorkEPv + 36
	22  CoreFoundation                      0x00000001a2d78c5c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28
	23  CoreFoundation                      0x00000001a2d78ba8 __CFRunLoopDoSource0 + 208
	24  CoreFoundation                      0x00000001a2d78894 __CFRunLoopDoSources0 + 268
	25  CoreFoundation                      0x00000001a2d77208 __CFRunLoopRun + 820
	26  CoreFoundation                      0x00000001a2d76734 CFRunLoopRunSpecific + 600
	27  HIToolbox                           0x00000001ab90ef68 RunCurrentEventLoopInMode + 292
	28  HIToolbox                           0x00000001ab90ecdc ReceiveNextEventCommon + 552
	29  HIToolbox                           0x00000001ab90ea9c _BlockUntilNextEventMatchingListInModeWithFilter + 72
	30  AppKit                              0x00000001a58cd000 _DPSNextEvent + 844
	31  AppKit                              0x00000001a58cb8a4 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1332
	32  AppKit                              0x00000001a58bd9b4 -[NSApplication run] + 596
	33  AppKit                              0x00000001a588f088 NSApplicationMain + 1064
	34  AppKit                              0x00000001a5b653c4 +[NSWindow _savedFrameFromString:] + 0
	35  UIKitMacHelper                      0x00000001b82839bc UINSApplicationMain + 1280
	36  UIKitCore                           0x00000001ca23f85c UIApplicationMain + 164
	37  OnlineBank                          0x0000000104e42e24 main + 64
	38  dyld                                0x00000001058790f4 start + 520

I opened a ticket with Apple and they told me that the problem was indeed in the Safari engine and this problem is OS level, it has nothing to do with our app. I did as they told me and opened another ticket on somewhere else. I explained the crash in details with multiple crash dump. The problem has appeared in macOS Monterey, it was not there previously. macOS 12.4 does not solve the problem. If you want to see my problem look for :

"Mac Catalyst WKWebview random crash since Monterey"

Have we had any updates from Apple on this one? It's still crashing for me.

I also faced the same crash in swift with the WKWebView of maccatalyst. In my case, when I open a screen that contains a UITextField and then open a screen that contain a WKWebView with editable area. It's crashes the app when i click on the WKWebview editable area.

So i followed this workaround to fix this crash. [https://stackoverflow.com/a/73772508/4160680) Let's hope this will help in your case.

I also faced this crash in WKWebview when I set the keyboard type to numberpad and autocorrectionType property to no in one of my UITextfield.