You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by ac...@apache.org on 2018/01/10 14:08:17 UTC
[2/4] incubator-weex git commit: replace `arguments` at runtime.
replace `arguments` at runtime.
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/43cec2cc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/43cec2cc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/43cec2cc
Branch: refs/heads/master
Commit: 43cec2cc852d11690782596ec71f4d25919b4b1d
Parents: 1d20e33
Author: Veight Zhou <ve...@gmail.com>
Authored: Mon Jan 8 20:11:05 2018 +0800
Committer: Veight Zhou <ve...@gmail.com>
Committed: Mon Jan 8 20:11:05 2018 +0800
----------------------------------------------------------------------
ios/sdk/WeexSDK/Sources/Bridge/WXBridgeMethod.m | 3 +--
ios/sdk/WeexSDK/Sources/Bridge/WXModuleMethod.m | 7 ++++++-
2 files changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/43cec2cc/ios/sdk/WeexSDK/Sources/Bridge/WXBridgeMethod.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Bridge/WXBridgeMethod.m b/ios/sdk/WeexSDK/Sources/Bridge/WXBridgeMethod.m
index f126f3d..a349849 100644
--- a/ios/sdk/WeexSDK/Sources/Bridge/WXBridgeMethod.m
+++ b/ios/sdk/WeexSDK/Sources/Bridge/WXBridgeMethod.m
@@ -103,8 +103,7 @@
}
NSArray *arguments = _arguments;
- // when target is an instance of NSError's subclass, checking is meaningless.
- if ((signature.numberOfArguments - 2 < arguments.count) && ![target isKindOfClass:[NSError class]]) {
+ if (signature.numberOfArguments - 2 < arguments.count) {
NSString *errorMessage = [NSString stringWithFormat:@"%@, the parameters in calling method [%@] and registered method [%@] are not consistent!", target, _methodName, NSStringFromSelector(selector)];
WX_MONITOR_FAIL(WXMTJSBridge, WX_ERR_INVOKE_NATIVE, errorMessage);
return nil;
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/43cec2cc/ios/sdk/WeexSDK/Sources/Bridge/WXModuleMethod.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Bridge/WXModuleMethod.m b/ios/sdk/WeexSDK/Sources/Bridge/WXModuleMethod.m
index 86479e1..51e3b9c 100644
--- a/ios/sdk/WeexSDK/Sources/Bridge/WXModuleMethod.m
+++ b/ios/sdk/WeexSDK/Sources/Bridge/WXModuleMethod.m
@@ -28,6 +28,8 @@
#import "WXHandlerFactory.h"
#import "WXValidateProtocol.h"
+#define ARGUMENTS @"arguments"
+
@implementation WXModuleMethod
- (instancetype)initWithModuleName:(NSString *)moduleName
@@ -59,7 +61,10 @@
WXLogError(@"%@", errorMessage);
WX_MONITOR_FAIL(WXMTJSBridge, WX_ERR_INVOKE_NATIVE, errorMessage);
if ([result.error respondsToSelector:@selector(userInfo)]) {
- // NSError instance won't work as target instance.
+ // In order to pass the argument count check in -[WXBridgeMethod invocationWithTarget:selector:]
+ if ([self respondsToSelector:NSSelectorFromString(ARGUMENTS)]) {
+ [self setValue:nil forKey:ARGUMENTS];
+ }
NSInvocation *invocation = [self invocationWithTarget:result.error selector:@selector(userInfo)];
[invocation invoke];
return invocation;