* [iOS] downgrade while jsfm restart
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/224a4e9a Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/224a4e9a Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/224a4e9a Branch: refs/heads/master Commit: 224a4e9a4de897b4eda604ce421fb8348e048979 Parents: 664ab3f Author: acton393 <zhangxing610...@gmail.com> Authored: Thu Jan 18 16:33:39 2018 +0800 Committer: acton393 <zhangxing610...@gmail.com> Committed: Thu Jan 18 16:33:39 2018 +0800 ---------------------------------------------------------------------- ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/224a4e9a/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m ---------------------------------------------------------------------- diff --git a/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m b/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m index cc52d17..55997d4 100644 --- a/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m +++ b/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m @@ -215,6 +215,10 @@ typedef enum : NSUInteger { [[NSNotificationCenter defaultCenter] postNotificationName:WX_SDKINSTANCE_WILL_RENDER object:self]; _mainBundleString = mainBundleString; if ([self _handleConfigCenter]) { + NSError * error = [NSError errorWithDomain:WX_ERROR_DOMAIN code:9999 userInfo:nil]; + if (self.onFailed) { + self.onFailed(error); + } return; } @@ -234,21 +238,17 @@ typedef enum : NSUInteger { BOOL useThreadSafeLock = [[configCenter configForKey:@"iOS_weex_ext_config.useThreadSafeLock" defaultValue:@NO isDefault:NULL] boolValue]; [WXUtility setThreadSafeCollectionUsingLock:useThreadSafeLock]; BOOL shoudMultiContext = NO; - if ([configCenter respondsToSelector:@selector(configForKey:defaultValue:isDefault:)]) { - shoudMultiContext = [[configCenter configForKey:@"iOS_weex_ext_config.createInstanceUsingMutliContext" defaultValue:@(NO) isDefault:NULL] boolValue]; - } + shoudMultiContext = [[configCenter configForKey:@"iOS_weex_ext_config.createInstanceUsingMutliContext" defaultValue:@(NO) isDefault:NULL] boolValue]; if(shoudMultiContext && ![WXSDKManager sharedInstance].multiContext) { [WXSDKManager sharedInstance].multiContext = YES; NSString *filePath = [[NSBundle bundleForClass:[self class]] pathForResource:@"weex-main-jsfm" ofType:@"js"]; NSString *script = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:nil]; [WXSDKEngine restartWithScript:script]; - [[NSNotificationCenter defaultCenter] postNotificationName:@"WXSDKENFINE_RESTARTED" object:nil]; return YES; } if (!shoudMultiContext && [WXSDKManager sharedInstance].multiContext) { [WXSDKManager sharedInstance].multiContext = NO; [WXSDKEngine restart]; - [[NSNotificationCenter defaultCenter] postNotificationName:@"WXSDKENFINE_RESTARTED" object:nil]; return YES; } } @@ -632,7 +632,6 @@ typedef enum : NSUInteger { [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationWillResignActive:) name:UIApplicationWillResignActiveNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidBecomeActive:) name:UIApplicationDidBecomeActiveNotification object:nil]; [self addObserver:self forKeyPath:@"state" options:NSKeyValueObservingOptionNew context:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(renderWithMainBundleString:) name:@"WXSDKENFINE_RESTARTED" object:nil]; } - (void)removeObservers