Edit a cloud variable only at second attempt

variables

#1

Hi again,

I have successfully created a cloud variable to store user data, however on Android, when I try to edit the data (for a strange reason) it only works at the second attempt or the following ones without exception; whereas on iOS it crashes at the first try.

Any ideas what might be happening?

Thanks


#2

Hi,

If you give a link to your project, it will be easier to understand the problem.


#3

My bad, here´s the link.

https://x.thunkable.com/copy/cdb3193d0c8620dc4a5afa85bb0d826d

The cloud variable is created at the screen “Perfil1_edit” and then it is edited at the screen “Menu”

Thanks


#4

I understand correctly that the app crashes on iOS when working with a cloud variable? If this is so, then it seems that there is a work with a non-existent object. Using the “generate Object from JSON” block, check the value of the variable. It is probably null.


#5

Ok so here are all the things I did based on your suggestions:

  1. Check for the null value with the " “generate Object from JSON” block"
    R: it was not null

  2. Asigned a label text to that generated JSON, then try to edit cloud variable with the text from that label
    R: still crashes on iOS; still editing is succesful at 2nd and further attempts

  3. Initialized a new app variable to create an object; generate a JSON and asign that item/text to the new app variable; then try to edit cloud variable with the text from that app variable
    R: still crashes on iOS; still editing is succesful at 2nd and further attempts

I´m not sure what else can be made.


#6

Can you try to create a very small example project that demonstrates the error and send out a share link to that?

-Mark


#7

I´ll try to do it, also I will put the new blocks that apparently work fine!

PS: I sent you a very very important DM. Please help! haha


#8

Here´s a small example of the version with the erros I mentioned (Incorrect screen) and the one I recently created without errors (Correct screen).
https://x.thunkable.com/copy/b7e048796c6a322b3c0d1e928f0870a7


#9

David,

Thanks for the smaller, simpler project to test. Could you tell me what steps I should take to demonstrate the incorrect behavior?

-Mark


#10

Incorrect screen

  1. Hit edit
  2. Hit edit for the specific value to edit
  3. Select an item from the list
  4. Save and confirm

On iOS the app crashed. On Android it only worked after a second attempt.


#11

How are you testing whether is worked or not?

-Mark


#12

I just realized I forgot to add a “Cancel” button in the app I shared. – The purpose of that button was if the user regret to do the changes and cancel the operation before submiting. By doing that it reseted everything as if the screen just opened – So when the issue happened I canceled the operation with the cancel button then tried again and it worked. Everytime I closed the app and reopen I had to do this double process of editing to make it work.
I hope I made myself clear haha


#13

I would still like to know what steps you took to test whether the save worked.


#14

I was looking directly at my Realtime DB to see if the change was done correctly after saving. I don´t know if that is what you meant.


#15

Yeah, that’s what I meant. Thanks.

-Mark