Skip to content
Permalink
Browse files

fix loading of dynamic linked JavaScriptCore on iOS simulator

Reviewed By: michalgr

Differential Revision: D3703392

fbshipit-source-id: 670185de1eefd1c542de2df96e40aede3b2c12cc
  • Loading branch information...
bnham authored and Facebook Github Bot committed Aug 12, 2016
1 parent 0e204e1 commit ce2f1192227558c8a0709b7486a3f277825105f4
Showing with 9 additions and 7 deletions.
  1. +9 −7 React/Executors/RCTJSCWrapper.mm
@@ -21,16 +21,18 @@
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;
}

0 comments on commit ce2f119

Please sign in to comment.
You can’t perform that action at this time.