Cannot start app on simulator, it's crash and show error dyld[27267]: Symbol not found:g

I build app success full, but app is crash when it's install and start on simulator, please help to resolve the issue. xcode version 16.3

dyld`__abort_with_payload: Thread 1: ****** SIGABRT

Console error log: dyld[27267]: Symbol not found: _$sSo18WKPDFConfigurationC6WebKitE4rectSo6CGRectVSgvs Referenced from: <9ED011A5-B4BE-3B0B-98C6-0AFAF76A5B6C> ..../Library/Developer/CoreSimulator/Devices/C94520D8-031D-4D91-8050-859E0951D1A6/data/Containers/Bundle/Application/522BF7A2-7633-4FF1-BA02-130727B8E65C/App.app/Frameworks/flutter_inappwebview_ios.framework/flutter_inappwebview_ios Expected in: <0085D0EC-09E4-3699-ACE9-9B0C20B090BB> /Library/Developer/CoreSimulator/Volumes/iOS_22C150/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 18.2.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/WebKit.framework/WebKit Symbol not found: _$sSo18WKPDFConfigurationC6WebKitE4rectSo6CGRectVSgvs Referenced from: <9ED011A5-B4BE-3B0B-98C6-0AFAF76A5B6C> ..../Library/Developer/CoreSimulator/Devices/C94520D8-031D-4D91-8050-859E0951D1A6/data/Containers/Bundle/Application/522BF7A2-7633-4FF1-BA02-130727B8E65C/App.app/Frameworks/flutter_inappwebview_ios.framework/flutter_inappwebview_ios Expected in: <0085D0EC-09E4-3699-ACE9-9B0C20B090BB> /Library/Developer/CoreSimulator/Volumes/iOS_22C150/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 18.2.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/WebKit.framework/WebKit dyld config: DYLD_SHARED_CACHE_DIR=.../Library/Developer/CoreSimulator/Caches/dyld/24D81/com.apple.CoreSimulator.SimRuntime.iOS-18-2.22C150 DYLD_ROOT_PATH=/Library/Developer/CoreSimulator/Volumes/iOS_22C150/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 18.2.simruntime/Contents/Resources/RuntimeRoot DYLD_LIBRARY_PATH=...../Library/Developer/Xcode/DerivedData/App-fdpvmjxapalesmhcoroqmpqwlxxm/Build/Products/Debug-iphonesimulator:/Library/Developer/CoreSimulator/Volumes/iOS_22C150/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 18.2.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/introspection DYLD_INSERT_LIBRARIES=/Library/Developer/CoreSimulator/Volumes/iOS_22C150/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 18.2.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libLogRedirect.dylib:/Library/Developer/CoreSimulator/Volumes/iOS_22C150/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 18.2.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libBacktraceRecording.dylib:/Library/Developer/CoreSimulator/Volumes/iOS_22C150/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 18.2.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libMainThreadChecker.dylib:/usr/lib/libRPAC.dylib:/Library/Developer/CoreSimulator/Volumes/iOS_22C150/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 18.2.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libViewDebuggerSupport.dylib DYLD_FRAMEWORK_PATH=.....Library/Developer/Xcode/DerivedData/App-fdpvmjxapalesmhcoroqmpqwlxxm/Build/Products/Debug-iphonesimulator DYLD_FALLBACK_FRAMEWORK_PATH=/Library/Developer/CoreSimulator/Volumes/iOS_22C150/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 18.2.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks DYLD_FALLBACK_LIBRARY_PATH=/Library/Developer/CoreSimulator/Volumes/iOS_22C150/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 18.2.simruntime/Contents/Resources/RuntimeRoot/usr/lib

Answered by DTS Engineer in 836871022

aarozco wrote:

are you able to reproduce on iOS 18.2

Ah, I missed that point. Thanks for bringing it to my attention.

Note It’s better to reply as a reply, rather than in the comments; see Quinn’s Top Ten DevForums Tips for this and other titbits.

I just created a new project from a template and added a button that calls this func:

Cool. I was able to distill this down even further, with a new app and a button that calls this:

func test() {
    let config = WKPDFConfiguration()
    print(config.rect ?? .zero)
}

As to what’s going on here, as far as I can tell this is a bug in the iOS simulator SDK [1] and I encourage you to file it as such.

Please post your bug number, just for the record.

Share and Enjoy

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

[1] I took my app and ran it on the iOS 18.4 simulator. That worked. I then ran it on the iOS 18.0 simulator and got this:

dyld[38131]: Symbol not found: _$sSo18WKPDFConfigurationC6WebKitE4rectSo6CGRectVSgvg
  Referenced from: <…/Test780782.debug.dylib
  Expected in:     <…/WebKit.framework/WebKit

The missing symbol is the getter for the rect property:

% swift demangle '_$sSo18WKPDFConfigurationC6WebKitE4rectSo6CGRectVSgvg'
_$sSo18WKPDFConfigurationC6WebKitE4rectSo6CGRectVSgvg ---> (extension in WebKit):__C.WKPDFConfiguration.rect.getter : __C.CGRect?

That symbol is present in the iOS 18.4 simulator:

% nm "/Library/Developer/CoreSimulator/Volumes/iOS_22E238/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 18.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/WebKit.framework/WebKit" | grep WKPDFConfiguration
…
0000000000de12f9 S $ld$previous$/usr/lib/swift/libswiftWebKit.dylib$$7$10.16$15.4$_$sSo18WKPDFConfigurationC6WebKitE4rectSo6CGRectVSgvg$
…
000000000000312c T _$sSo18WKPDFConfigurationC6WebKitE4rectSo6CGRectVSgvg
…

but not present in the iOS 18.0 one:

% nm "/Library/Developer/CoreSimulator/Volumes/iOS_22A3351/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 18.0.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/WebKit.framework/WebKit" | grep WKPDFConfiguration
… no reference to _$sSo18WKPDFConfigurationC6WebKitE4rectSo6CGRectVSgvg …

The reason for that relates to the second symbol in the iOS 18.4 output, that is:

$ld$previous$/usr/lib/swift/libswiftWebKit.dylib$$7$10.16$15.4$_$sSo18WKPDFConfigurationC6WebKitE4rectSo6CGRectVSgvg$

I’m not sure if that symbol format is documented anywhere, but it’s pretty easy to understand:

  • $ld$previous$ indicates that the symbol moved into this library from some other library.

  • /usr/lib/swift/libswiftWebKit.dylib is the original library.

  • 7 is the platform, which in this case is PLATFORM_IOSSIMULATOR as defined in <mach-o/loader.h>.

  • 10.16 and 15.4 is the range of OS releases where the symbol was present in that other library. Note that this is a half closed range, that is 10.16 ..< 15.4.

  • _$sSo18WKPDFConfigurationC6WebKitE4rectSo6CGRectVSgvg is the symbol name.

This symbol tells the static linker that the rect getter moved from the WebKit Swift overlay (libswiftWebKit.dylib) into the WebKit framework proper in iOS 18.4. Except it doesn’t. Because that the range is the macOS range [2], not the iOS range. For iOS, and hence the iOS simulator, I’d expect to see 14.0 and 18.4. So, because my app’s deployment target is iOS 18.0, it doesn’t fall into that range, so the static linker records a reference to the framework rather than the overlay, and thus the dynamic linker is unable to find the symbol.

Amusingly, if I change my app’s deployment target to iOS 15.0, it launches, because iOS 15.0 is less than macOS 15.4 (-: Needless to say, that’s not a great workaround.

[2] In this context, 10.16 is macOS 11.

Let’s break down this error:

Console error log:
dyld[27267]: Symbol not found: _$sSo18WKPDFConfigurationC6WebKitE4rectSo6CGRectVSgvs
Referenced from: …/flutter_inappwebview_ios 
Expected in: …/WebKit.framework/WebKit 

Now demangle the symbol:

% swift demangle '_$sSo18WKPDFConfigurationC6WebKitE4rectSo6CGRectVSgvs'
_$sSo18WKPDFConfigurationC6WebKitE4rectSo6CGRectVSgvs ---> (extension in WebKit):__C.WKPDFConfiguration.rect.setter : __C.CGRect?

So, the problem is that you’re trying to use the Swift overlay of the setter for the rect property on WKPDFConfiguration, and that’s not available for some reason.

I then create a new app from the iOS > App project template and added a button that calls this code:

func test() {
    let c = WKPDFConfiguration()
    c.rect = .infinite
    print(c)
}

It runs just fine in the simulator (macOS 15.3.2 with Xcode 16.3 targeting iOS 18.4 Simulator). And dumping the resulting app reveals that it is in fact using that symbol:

% dyld_info -imports Test780782.app/Test780782.debug.dylib | grep WKPDFConfiguration
      0x0010  _$sSo18WKPDFConfigurationC6WebKitE4rectSo6CGRectVSgvs  (from WebKit)
      0x0029  _OBJC_CLASS_$_WKPDFConfiguration  (from WebKit)

So my advice here is that you try reproducing my test in your environment. If that fails, there’s something going wrong with the Apple side of this and I can help you investigate that. OTOH, if it works and your main project still fails, that’s something to escalate via the support channel for your third-party tooling.

Share and Enjoy

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

Our team has also encountered issues with WKPDFConfiguration on simulators running iOS versions earlier than 18.4

I just created a new project from a template and added a button that calls this func:

 func test() {
        let view = WKWebView()
        
        Task {
            let pdf = try? await view.pdf()
            print(pdf)
        }
    }

There are no issues on a simulator with iOS 18.4, but if I choose a simulator with iOS 18.3.1 or 17.5 (I haven’t tested all versions), I get an error on launch.

dyld[82520]: Symbol not found: _$sSo9WKWebViewC6WebKitE3pdf13configuration10Foundation4DataVSo18WKPDFConfigurationC_tYaKF
  Referenced from: <B4A99988-AC58-30E1-B1B0-E2E036D56E9E> /Users/jlow/Library/Developer/CoreSimulator/Devices/50B15315-D19E-4E4C-8545-3FD87F7DE932/data/Containers/Bundle/Application/2AAFBB29-63B7-4896-B728-D6EC213F0BAA/Test.app/Test.debug.dylib
  Expected in:     <43C11484-B1FB-38C4-B136-8685F00B82F2> /Library/Developer/CoreSimulator/Volumes/iOS_22D8075/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 18.3.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/WebKit.framework/WebKit

Hi, same issue is also happening with other symbols like callAsyncJavaScript:

func callAsyncJavaScript(

_ functionBody: String,
arguments: [String : Any] = [:],
in frame: WKFrameInfo? = nil,
in contentWorld: WKContentWorld,
completionHandler: (@MainActor (Result<Any, any Error>) -> Void)? = nil

)

It works fine for iOS 18.4 runtime, but fails with previous ones when looking for this symbol:

swift demangle '_$sSo9WKWebViewC6WebKitE19callAsyncJavaScript_9arguments2inAF17completionHandlerySS_SDySSypGSo11WKFrameInfoCSgSo14WKContentWorldCys6ResultOyyps5Error_pGcSgtF'
_$sSo9WKWebViewC6WebKitE19callAsyncJavaScript_9arguments2inAF17completionHandlerySS_SDySSypGSo11WKFrameInfoCSgSo14WKContentWorldCys6ResultOyyps5Error_pGcSgtF ---> (extension in WebKit):__C.WKWebView.callAsyncJavaScript(_: Swift.String, arguments: [Swift.String : Any], in: __C.WKFrameInfo?, in: __C.WKContentWorld, completionHandler: ((Swift.Result<Any, Swift.Error>) -> ())?) -> ()

Hi, our team is also experiencing a similar issue, with the same output as @OswaldoRubio, on all simulator builds below iOS 18.4.

dyld[4448]: Symbol not found: _$sSo9WKWebViewC6WebKitE19callAsyncJavaScript_9arguments2inAF17completionHandlerySS_SDySSypGSo11WKFrameInfoCSgSo14WKContentWorldCys6ResultOyyps5Error_pGcSgtF
  Referenced from: <2FD78971-D40C-3BDB-AAA3-71E7F1369ED4> /Users/.../Library/Developer/CoreSimulator/Devices/1133E3AD-0ADC-428E-9E02-7A221B181634/data/Containers/Bundle/Application/A902C8CC-E2F7-43C8-97BB-C2CCF71062D0/App.app/App.debug.dylib
  Expected in:     <43C11484-B1FB-38C4-B136-8685F00B82F2> /Library/Developer/CoreSimulator/Volumes/iOS_22D8075/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 18.3.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/WebKit.framework/WebKit

We're also seeing this issue with Xcode 16.3. The app crashes on startup on simulators running < iOS 18.4. In our case we see the issue with WKPDFConfiguration and with WKWebView.find. When we remove those from our code it runs fine.

Here's some minimal code that causes the crash (on < iOS 18.4):

import SwiftUI
import WebKit

// Add one of these in ContentView.Swift
struct WebViewRepresentable: UIViewRepresentable {
    func makeUIView(context: Context) -> WKWebView {
        let webView = WKWebView()
        let url = URL(string: "https://apple.com")!
        let request = URLRequest(url: url)
        webView.load(request)
        
        // Causes crash on < iOS 18.4
        webView.find("apple") { _ in }
        
        return webView
    }

    func updateUIView(_ uiView: WKWebView, context: Context) { }
}

I've also run the following: nm -gU <path-to-simulator-ios-version-runtime-frameworks>/WebKit.framework/WebKit> | grep find. The symbols show up in iOS 18.4 but not others.

Here an example of a full path to the WebKit framework in case its useful to anyone: /Library/Developer/CoreSimulator/Volumes/iOS_22C150/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 18.2.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/WebKit.framework.

aarozco wrote:

are you able to reproduce on iOS 18.2

Ah, I missed that point. Thanks for bringing it to my attention.

Note It’s better to reply as a reply, rather than in the comments; see Quinn’s Top Ten DevForums Tips for this and other titbits.

I just created a new project from a template and added a button that calls this func:

Cool. I was able to distill this down even further, with a new app and a button that calls this:

func test() {
    let config = WKPDFConfiguration()
    print(config.rect ?? .zero)
}

As to what’s going on here, as far as I can tell this is a bug in the iOS simulator SDK [1] and I encourage you to file it as such.

Please post your bug number, just for the record.

Share and Enjoy

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

[1] I took my app and ran it on the iOS 18.4 simulator. That worked. I then ran it on the iOS 18.0 simulator and got this:

dyld[38131]: Symbol not found: _$sSo18WKPDFConfigurationC6WebKitE4rectSo6CGRectVSgvg
  Referenced from: <…/Test780782.debug.dylib
  Expected in:     <…/WebKit.framework/WebKit

The missing symbol is the getter for the rect property:

% swift demangle '_$sSo18WKPDFConfigurationC6WebKitE4rectSo6CGRectVSgvg'
_$sSo18WKPDFConfigurationC6WebKitE4rectSo6CGRectVSgvg ---> (extension in WebKit):__C.WKPDFConfiguration.rect.getter : __C.CGRect?

That symbol is present in the iOS 18.4 simulator:

% nm "/Library/Developer/CoreSimulator/Volumes/iOS_22E238/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 18.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/WebKit.framework/WebKit" | grep WKPDFConfiguration
…
0000000000de12f9 S $ld$previous$/usr/lib/swift/libswiftWebKit.dylib$$7$10.16$15.4$_$sSo18WKPDFConfigurationC6WebKitE4rectSo6CGRectVSgvg$
…
000000000000312c T _$sSo18WKPDFConfigurationC6WebKitE4rectSo6CGRectVSgvg
…

but not present in the iOS 18.0 one:

% nm "/Library/Developer/CoreSimulator/Volumes/iOS_22A3351/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 18.0.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/WebKit.framework/WebKit" | grep WKPDFConfiguration
… no reference to _$sSo18WKPDFConfigurationC6WebKitE4rectSo6CGRectVSgvg …

The reason for that relates to the second symbol in the iOS 18.4 output, that is:

$ld$previous$/usr/lib/swift/libswiftWebKit.dylib$$7$10.16$15.4$_$sSo18WKPDFConfigurationC6WebKitE4rectSo6CGRectVSgvg$

I’m not sure if that symbol format is documented anywhere, but it’s pretty easy to understand:

  • $ld$previous$ indicates that the symbol moved into this library from some other library.

  • /usr/lib/swift/libswiftWebKit.dylib is the original library.

  • 7 is the platform, which in this case is PLATFORM_IOSSIMULATOR as defined in <mach-o/loader.h>.

  • 10.16 and 15.4 is the range of OS releases where the symbol was present in that other library. Note that this is a half closed range, that is 10.16 ..< 15.4.

  • _$sSo18WKPDFConfigurationC6WebKitE4rectSo6CGRectVSgvg is the symbol name.

This symbol tells the static linker that the rect getter moved from the WebKit Swift overlay (libswiftWebKit.dylib) into the WebKit framework proper in iOS 18.4. Except it doesn’t. Because that the range is the macOS range [2], not the iOS range. For iOS, and hence the iOS simulator, I’d expect to see 14.0 and 18.4. So, because my app’s deployment target is iOS 18.0, it doesn’t fall into that range, so the static linker records a reference to the framework rather than the overlay, and thus the dynamic linker is unable to find the symbol.

Amusingly, if I change my app’s deployment target to iOS 15.0, it launches, because iOS 15.0 is less than macOS 15.4 (-: Needless to say, that’s not a great workaround.

[2] In this context, 10.16 is macOS 11.

Cannot start app on simulator, it's crash and show error dyld[27267]: Symbol not found:g
 
 
Q