New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed iOS/JS-Bind callStaticMethod() with bool arg #12598

Merged
merged 1 commit into from Jul 1, 2015

Conversation

Projects
None yet
3 participants
@shinhirota
Contributor

shinhirota commented Jun 30, 2015

Problem

Boolean arguments from JavaScript via jsb.reflection.callStaticMethod() cannot be received by C++ static methods like:

+ (void) setAdVisible:(BOOL) isVisible {
   if (isVisible) { // <== This "isVisible" is always NO due to the problem.
    // do something
   } 
}

Here is the workaround we are using currently.

// Workaround
+ (void) setAdVisible:(NSNumber*) isVisible {
   if ([isVisible booleanValue) { //<== Use NSNumber for boolean arguments.
    // do something
   } 
}

After this commit "Fixed iOS/JS-Bind callStaticMethod() with bool arg.", you can call the function of the upper example.

@pandamicro

This comment has been minimized.

Show comment
Hide comment
@pandamicro

pandamicro Jun 30, 2015

Member

@jianglong0156 please review this PR

Member

pandamicro commented Jun 30, 2015

@jianglong0156 please review this PR

@jianglong0156

This comment has been minimized.

Show comment
Hide comment
@jianglong0156

jianglong0156 Jul 1, 2015

the pr is right, can be merge.@pandamicro @shinhirota

jianglong0156 commented Jul 1, 2015

the pr is right, can be merge.@pandamicro @shinhirota

@jianglong0156

This comment has been minimized.

Show comment
Hide comment
@jianglong0156

jianglong0156 Jul 1, 2015

i will add the testcase in the js-test. thank you for contribution.

jianglong0156 commented Jul 1, 2015

i will add the testcase in the js-test. thank you for contribution.

@shinhirota

This comment has been minimized.

Show comment
Hide comment
@shinhirota

shinhirota Jul 1, 2015

Contributor

Great. Thank you for your support!

Contributor

shinhirota commented Jul 1, 2015

Great. Thank you for your support!

pandamicro added a commit that referenced this pull request Jul 1, 2015

Merge pull request #12598 from shinhirota/v3
Fixed iOS/JS-Bind callStaticMethod() with bool arg

@pandamicro pandamicro merged commit 4d95c87 into cocos2d:v3 Jul 1, 2015

1 check passed

Jenkins CI Build successfully!
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment