Start a new topic

BOOL and how it is stored in the database.

Hi all,



On this page http://devcenter.kinvey.com/ios/guides/datastore it mentions that BOOL in iOS is stored as true/false : "(true / false for BOOL)"



But in the back end it is stored as 0 and 1. If you have a boolean in java it stores it as true or false. Will this cause a problem? If so is there any easy way to make BOOL be true or false?



Thanks,

Sean

So it turns out that it is a problem, Java expects to see true/false but instead gets a number and I get a error of unable to parse response -> key userEnteredPlace. Also if on android it also gives an error expected numiric type but got boolean. So there is a issue right now if you store a BOOL in the database on iOS it will crash android and java boolean types.
Sorry cannot find a way to edit my original post. But the answer is if you use lower case bool it works fine. So maybe a good idea to change the documentation to say bool not BOOL.



thanks,

Sean

1 person likes this
Hm, this is an interesting problem. Perhaps you could create a validation rule to change the bool to a numeric type depending on the device?
Like I said I found out that if in iOS you store it as bool it fix's the problem. It is just confusing because your documentation says that BOOL is stored as true or false when in fact BOOL is stored as a number and bool is stored as true or false. So no new code is needed it can simply be fixed by using bool.
Makes sense. Darn forum non-threading makes it hard to tell what order posts are in!
Login or Signup to post a comment