Hi,
[NSAttributedString initWithHTML:] fails when running natively on Apple Silicon, but doesn't fail when running on Intel.
In our app, it crashes with "EXC_BREAKPOINT (code=1, subcode=0x1bade08f4)" on this simple example (a unit test with our app as a host application):
The last of the stack trace when this happens look like this:
I am not seeing anything obvious we're doing wrong, or that there should be problems calling [NSAttributedString initWithHTML:] on Apple Silicon. I saw a mention somewhere that it has to happen on the main thread, and this is what we're doing, so I'm not sure why it would crash.
Any help wold be appreciated.
[NSAttributedString initWithHTML:] fails when running natively on Apple Silicon, but doesn't fail when running on Intel.
In our app, it crashes with "EXC_BREAKPOINT (code=1, subcode=0x1bade08f4)" on this simple example (a unit test with our app as a host application):
Code Block -(void)testExample { NSString *string = @"a"; NSData *htmlData = [string dataUsingEncoding:NSUTF8StringEncoding]; NSAttributedString *htmlString = [[NSAttributedString alloc] initWithHTML: htmlData options: @{ NSDocumentTypeDocumentOption: NSHTMLTextDocumentType, NSCharacterEncodingDocumentOption: @(NSUTF8StringEncoding), } documentAttributes: nil]; XCTAssertNotNil(htmlString); }
The last of the stack trace when this happens look like this:
Code Block * thread #1, name = 'UI', queue = 'com.apple.main-thread', stop reason = EXC_BREAKPOINT (code=1, subcode=0x1bade08f4) frame #0: 0x00000001bade08f4 JavaScriptCore`void JSC::LinkBuffer::copyCompactAndLinkCode<unsigned int>(JSC::MacroAssembler&, JSC::JITCompilationEffort) + 2784 frame #1: 0x00000001baddfd14 JavaScriptCore`JSC::LinkBuffer::linkCode(JSC::MacroAssembler&, JSC::JITCompilationEffort) + 60 frame #2: 0x00000001bb3e08f0 JavaScriptCore`JSC::nativeForGenerator(JSC::VM&, JSC::ThunkFunctionType, JSC::CodeSpecializationKind, JSC::ThunkEntryType) + 1856 frame #3: 0x00000001bb3cdc80 JavaScriptCore`JSC::JITThunks::ctiStub(JSC::VM&, JSC::MacroAssemblerCodeRef<(***::PtrTag)3497> (*)(JSC::VM&)) + 140 frame #4: 0x00000001bb3cde50 JavaScriptCore`JSC::JITThunks::ctiInternalFunctionCall(JSC::VM&) + 36 frame #5: 0x00000001bb6e30b0 JavaScriptCore`JSC::VM::VM(JSC::VM::VMType, JSC::HeapType, ***::RunLoop*, bool*) + 14648 frame #6: 0x00000001bb6e3db0 JavaScriptCore`JSC::VM::create(JSC::HeapType, ***::RunLoop*) + 60 frame #7: 0x00000001bf09d81c WebCore`WebCore::PageScriptDebugServer::PageScriptDebugServer(WebCore::Page&) + 72 frame #8: 0x00000001bf07fb98 WebCore`WebCore::InspectorController::InspectorController(WebCore::Page&, WebCore::InspectorClient*) + 436 frame #9: 0x00000001bf266718 WebCore`WebCore::Page::Page(WebCore::PageConfiguration&&) + 360 frame #10: 0x00000001b913ae48 WebKitLegacy`-[WebView(WebPrivate) _commonInitializationWithFrameName:groupName:] + 2752 frame #11: 0x00000001b92547b8 WebKitLegacy`-[WebView(WebPrivate) _initWithFrame:frameName:groupName:] + 116 frame #12: 0x00000001a8f03568 UIFoundation`-[NSHTMLReader _loadUsingWebKit] + 824 frame #13: 0x00000001a8f02eec UIFoundation`-[NSHTMLReader attributedString] + 32 frame #14: 0x00000001a8eee0b8 UIFoundation`_NSReadAttributedStringFromURLOrData + 7072 frame #15: 0x00000001a8eec48c UIFoundation`-[NSAttributedString(NSAttributedStringUIFoundationAdditions) initWithData:options:documentAttributes:error:] + 156 * frame #16: 0x0000000113e4e860 Tests`-[CrashTests testExample](self=0x0000600002ba5e00, _cmd="testExample") at CrashTests.m:45:38
I am not seeing anything obvious we're doing wrong, or that there should be problems calling [NSAttributedString initWithHTML:] on Apple Silicon. I saw a mention somewhere that it has to happen on the main thread, and this is what we're doing, so I'm not sure why it would crash.
Any help wold be appreciated.