Is Android boolean compatible with objective-c BOOL?

Options
Vasilis
Vasilis
edited October 2019 in Native
Hi,

I know that my question does not make any sense, but, I do not know what else to check on my code.

I am trying to update a user properties on the Android. For that I create a
ExitGames::Common::Hashtable properties ;

and I set properties.put("Online", true); I put a few more keys in that HashTable.

Then on the iOS version, I get this value with the following method:

[[dicData objectForKey:@Online]getValue:&_isOnline];

The value of isOnline is false!! The value of the other properties are correct! What am I missing here?

Thank you

Comments

  • Kaiserludi
    Options
    Hi @Vasilis.

    I have just tested this and it works fine for me.

    You could call the toString function on both, the C++ Hashtable as well as the objective C NSDictionary and log the returned string, to see, if the boolean value is inside.
  • Vasilis
    Vasilis
    edited October 2019
    Options
    Hi @Kaiserludi,

    Yes, when I call the string() method on both objects, I get that "Online"=true.
    And, when I call the method in objective-c code, that Online is set to true. But, then, after a while it it set to false. Something is wrong with my code. I have no idea was is causing this, but this is my fault.

    I apologize for the trouble, and thank you for looking into it!!
  • Vasilis
    Options
    The problem was that on Android I was sending integer, and on the iOS I was setting that value to a char. When I send nByte on Android, the problem was gone.
  • Kaiserludi
    Kaiserludi admin
    edited November 2019
    Options
    Hi @Vasilis.

    I don't think that I follow. How does sending an integer on Android and setting the same value to a char on iOS relate to the issue that you had with sending a bool on Android and retrieving it on iOS?
  • Vasilis
    Options
    Hi @Kaiserludi,

    initially, on the iOS code, the boolean had the correct value (the one that was set on the Android). But, when it set the value of the integer to a char, the code would start to misbehave. As a result of that action, it would set the boolean to false.