diff --git a/React/Executors/RCTJSCWrapper.mm b/React/Executors/RCTJSCWrapper.mm index 222ebfc661b..237eb64e591 100644 --- a/React/Executors/RCTJSCWrapper.mm +++ b/React/Executors/RCTJSCWrapper.mm @@ -21,16 +21,18 @@ static void *RCTCustomLibraryHandler(void) static dispatch_once_t token; static void *handler; dispatch_once(&token, ^{ - const char *path = [[[NSBundle mainBundle] pathForResource:@"JavaScriptCore" - ofType:nil - inDirectory:@"Frameworks/JavaScriptCore.framework"] UTF8String]; - if (path) { - handler = dlopen(path, RTLD_LAZY); - if (!handler) { - RCTLogWarn(@"Can't load custom JSC library: %s", dlerror()); + handler = dlopen("@executable_path/Frameworks/JavaScriptCore.framework/JavaScriptCore", RTLD_LAZY); + if (!handler) { + const char *err = dlerror(); + + // Ignore the dlopen failure if custom JSC wasn't included in our app + // bundle. Unfortunately dlopen only provides string based errors. + if (err != nullptr && strstr(err, "image not found") == nullptr) { + RCTLogWarn(@"Can't load custom JSC library: %s", err); } } }); + return handler; }