Skip to content
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

SFSArray:getBool returning null on iOS (+ suggested fix) #13

Closed
rewb0rn opened this issue Mar 1, 2018 · 3 comments
Closed

SFSArray:getBool returning null on iOS (+ suggested fix) #13

rewb0rn opened this issue Mar 1, 2018 · 3 comments

Comments

@rewb0rn
Copy link

rewb0rn commented Mar 1, 2018

Hello,

when compiling the library with Air for iOS (Objective C, not interpreter), the function SFSArray::getBool is always returning null at the moment.

This is the original line that causes a problem:
return(wrapper != null ?cast(wrapper.data,Bool):null);

I was testing a bit and this is the easiest way to fix it:

return(wrapper != null ?cast(wrapper.data):null);

I can prepare a pull request, do you have any concerns or another preferred fix?

Just a sidenote: iOS with Air builds have some of these mystery bugs from time to time, due to the fact that the compilation works differently on the platform (no AVM). We have seen some rare and strange issues in AS3 code on iOS as well, before we started using Haxe.

@rewb0rn rewb0rn changed the title getBool returning null on iOS (+ suggested fix) SFSArray:getBool returning null on iOS (+ suggested fix) Mar 1, 2018
@boorik
Copy link
Owner

boorik commented Mar 1, 2018

Hi,
This fix is really strange. Only unsafe cast works???
This must not have any side effects on other targets. You can send a PR.
But this is really odd.

@rewb0rn
Copy link
Author

rewb0rn commented Mar 1, 2018

So far, only getBool seems to be affected. getInt() etc. seem to work fine. As I said, there are sometimes very strange bugs on iOS. I did some debugging and it's even stranger:

var val:Bool = cast(wrapper.data,Bool);
trace(this, val);

return val;

Then the trace outputs the correct value (true or false), but the function still returns null. So probably there is a weird problem returning or casting Bool to Null<Bool> on iOS.

Anyway I will create the pull request.

@boorik
Copy link
Owner

boorik commented Mar 1, 2018

Merged.
Thank you

@boorik boorik closed this as completed Mar 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants