mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-01 07:42:38 +08:00
[iOS] jsb.reflection.callStaticMethod supports to call objective-c method with NSNumber* and supports to pass undefined/null from JS. (#1010)
This commit is contained in:
@@ -163,6 +163,11 @@ bool JavaScriptObjCBridge::CallInfo::execute(const se::ValueArray& argv, se::Val
|
||||
unsigned char val = arg.toUint8();
|
||||
[invocation setArgument:&val atIndex:i];
|
||||
}
|
||||
else if (argumentType == "@")
|
||||
{ // NSNumber*
|
||||
NSNumber* number = [NSNumber numberWithDouble:arg.toNumber()];
|
||||
[invocation setArgument:&number atIndex:i];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"Unsupported argument type: %s", argumentType.c_str());
|
||||
@@ -189,6 +194,10 @@ bool JavaScriptObjCBridge::CallInfo::execute(const se::ValueArray& argv, se::Val
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (arg.isNullOrUndefined())
|
||||
{
|
||||
// Don't call [invocation setArgument] will pass nil to relevant Objective-C argument.
|
||||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"Unsupported argument type, se::Value::Type: %d", (int)arg.getType());
|
||||
|
||||
Reference in New Issue
Block a user