Repository: incubator-weex Updated Branches: refs/heads/master 9e8f8f650 -> df0eb7d11
[WEEX-489][iOS] Fix resource not loaded when using dynamic framework solution in some cases. Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/df0eb7d1 Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/df0eb7d1 Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/df0eb7d1 Branch: refs/heads/master Commit: df0eb7d117c6f5bc7fe1d150b958e974ba2c374e Parents: 9e8f8f6 Author: Xiaomin <[email protected]> Authored: Mon Jul 2 15:38:31 2018 +0800 Committer: Xiaomin <[email protected]> Committed: Mon Jul 2 15:38:31 2018 +0800 ---------------------------------------------------------------------- ios/sdk/WeexSDK/Sources/Bridge/WXBridgeContext.m | 6 ++++++ ios/sdk/WeexSDK/Sources/Engine/WXSDKEngine.m | 6 ++++++ ios/sdk/WeexSDK/Sources/View/WXErrorView.m | 3 +++ 3 files changed, 15 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/df0eb7d1/ios/sdk/WeexSDK/Sources/Bridge/WXBridgeContext.m ---------------------------------------------------------------------- diff --git a/ios/sdk/WeexSDK/Sources/Bridge/WXBridgeContext.m b/ios/sdk/WeexSDK/Sources/Bridge/WXBridgeContext.m index e7243af..6fab4ab 100644 --- a/ios/sdk/WeexSDK/Sources/Bridge/WXBridgeContext.m +++ b/ios/sdk/WeexSDK/Sources/Bridge/WXBridgeContext.m @@ -528,6 +528,9 @@ _Pragma("clang diagnostic pop") \ sdkInstance.bundleType = bundleType; if ([bundleType.lowercaseString isEqualToString:@"rax"]) { raxAPIScriptPath = [[NSBundle bundleForClass:[weakSelf class]] pathForResource:@"weex-rax-api" ofType:@"js"]; + if (raxAPIScriptPath == nil) { + raxAPIScriptPath = [[NSBundle mainBundle] pathForResource:@"weex-rax-api" ofType:@"js"]; + } raxAPIScript = [NSString stringWithContentsOfFile:raxAPIScriptPath encoding:NSUTF8StringEncoding error:nil]; if (!raxAPIScript) { WXLogError(@"weex-rax-api can not found"); @@ -565,6 +568,9 @@ _Pragma("clang diagnostic pop") \ if (WX_SYS_VERSION_LESS_THAN(@"10.2")) { NSString *filePath = [[NSBundle bundleForClass:[weakSelf class]] pathForResource:@"weex-polyfill" ofType:@"js"]; + if (filePath == nil) { + filePath = [[NSBundle mainBundle] pathForResource:@"weex-polyfill" ofType:@"js"]; + } NSString *script = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:nil]; if (script) { [sdkInstance.instanceJavaScriptContext executeJavascript:script withSourceURL:[NSURL URLWithString:filePath]]; http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/df0eb7d1/ios/sdk/WeexSDK/Sources/Engine/WXSDKEngine.m ---------------------------------------------------------------------- diff --git a/ios/sdk/WeexSDK/Sources/Engine/WXSDKEngine.m b/ios/sdk/WeexSDK/Sources/Engine/WXSDKEngine.m index e2d35d6..91fdd90 100644 --- a/ios/sdk/WeexSDK/Sources/Engine/WXSDKEngine.m +++ b/ios/sdk/WeexSDK/Sources/Engine/WXSDKEngine.m @@ -207,6 +207,9 @@ } } NSString *filePath = [[NSBundle bundleForClass:self] pathForResource:fileName ofType:@"js"]; + if (filePath == nil) { + filePath = [[NSBundle mainBundle] pathForResource:fileName ofType:@"js"]; + } NSString *script = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:nil]; [WXSDKEngine initSDKEnvironment:script]; @@ -309,6 +312,9 @@ static NSDictionary *_customEnvironment; } } NSString *filePath = [[NSBundle bundleForClass:self] pathForResource:fileName ofType:@"js"]; + if (filePath == nil) { + filePath = [[NSBundle mainBundle] pathForResource:fileName ofType:@"js"]; + } NSString *script = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:nil]; [self restartWithScript:script]; } http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/df0eb7d1/ios/sdk/WeexSDK/Sources/View/WXErrorView.m ---------------------------------------------------------------------- diff --git a/ios/sdk/WeexSDK/Sources/View/WXErrorView.m b/ios/sdk/WeexSDK/Sources/View/WXErrorView.m index c65c3a4..b020842 100644 --- a/ios/sdk/WeexSDK/Sources/View/WXErrorView.m +++ b/ios/sdk/WeexSDK/Sources/View/WXErrorView.m @@ -29,6 +29,9 @@ UIImageView *imageView = [[UIImageView alloc]initWithFrame:self.bounds]; NSBundle *bundle = [NSBundle bundleForClass:self.class]; NSString *file = [bundle pathForResource:@"wx_load_error@3x" ofType:@"png"]; + if (file == nil) { + file = [[NSBundle mainBundle] pathForResource:@"wx_load_error@3x" ofType:@"png"]; + } imageView.image = [UIImage imageWithContentsOfFile:file]; [self addSubview:imageView];
