mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-24 04:16:00 +08:00
fix loading of dynamic linked JavaScriptCore on iOS simulator
Reviewed By: michalgr Differential Revision: D3703392 fbshipit-source-id: 670185de1eefd1c542de2df96e40aede3b2c12cc
This commit is contained in:
committed by
Facebook Github Bot
parent
0e204e1141
commit
ce2f119222
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user