dyld Symbol Not Found on Some Devices

I have a React-Native App that I am trying to build to iOS using Xcode. When I build to my iPhone 12 Mini (iOS 17.4.1), the app works perfectly. When I build to my iPhone 7 Plus (iOS 15.8.2), the app pauses running immediately, and Xcode displays the following in the log:

dyld[935]: Symbol not found: (_JSGlobalContextSetInspectable)
  Referenced from: '/private/var/containers/Bundle/Application/2579192B-74C5-4B54-AA59-948C49A4A7CA/MANHUNT2.app/MANHUNT2'
  Expected in: '/System/Library/Frameworks/JavaScriptCore.framework/JavaScriptCore'

The app used to work perfectly on both phones, but this error has been happening recently, and I am unsure of the cause. Cleaning build folder and deleting derived data has not fixed the issue.

Xcode: Version 15.3

React-Native: 0.73.6

Working Phone: iOS 17.4.1

Non-Working Phone: iOS 15.8.2

Replies

JSGlobalContextSetInspectable was added in iOS 16.4. If your app runs on older versions of iOS, conditionalise your code so that it only calls that routine if it’s present.

How you do this depends on the language you’re using to call that code. If you wrote this code yourself, let me know what language it’s in and I can explain the best path forward. If this code is coming from a third-party library, I recommend that you escalate this via that library’s support channel.

Share and Enjoy

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

Thank you for responding Quinn! For reference for other who are encountering the same problem, or for myself many months from now when I encounter it again and forget how I fixed it, I am writing this reply. The problem was with the file node_nodules/react-native/ReactCommon/jsc/JSCRuntime.cpp. This little chunk of code starts at line 361:

JSCRuntime::JSCRuntime(JSGlobalContextRef ctx)
    : ctx_(JSGlobalContextRetain(ctx)),
      ctxInvalid_(false)
#ifndef NDEBUG
      ,
      objectCounter_(0),
      stringCounter_(0)
#endif
{
#ifndef NDEBUG
#ifdef _JSC_HAS_INSPECTABLE
    /* Causes dyld symbol not found error
  if (__builtin_available(macOS 13.3, iOS 16.4, tvOS 16.4, *)) {
    JSGlobalContextSetInspectable(ctx_, true);
  */
#endif
#endif
}

By commenting out the portion that uses JSGlobalContextSetInspectable, I was able to make the dyld[935]: Symbol not found: (_JSGlobalContextSetInspectable) error stop occurring.

If you want to keep the feature on iOS 16.4+:

#if ( __OSX_AVAILABLE_STARTING(MAC_NA, IPHONE_16_4))
      JSGlobalContextSetInspectable(ctx_, true);
#endif