[Solved] iOS downloaded app crashes on data save using Stored variables

app link: Thunkable
this is just the screen i am referencing from my larger app. all variables used in the “save behaviors” button are initialized on the same screen

I am trying to save a string to a variable. When I save a string, it causes the downloaded app to crash. On restart, the variable shows the value I attempted to save which is fine. The issue is that saving causes a glitch. I am hoping someone in the community can check this code out and perhaps the app and let me know if you see anything that would cause an error.

Also I should mention, if there is no text in the text inputs, the alerts work just fine and the app doesn’t crash. They tell the user to put some text into the text box and doesn’t save anything.

The weird part is that when I use the live companion app, this behavior does not occur. Only on the downloaded app.

I am on iOS 13 using both an iPhone and iPad.

@domhnallohanlon had asked if the variables that I am saving to would have been initialized at this point and the answer is yes. They are initialized on this screen however they are referenced on a previous screen. That said, if they are empty on the previous screen, the user is sent to the ‘set up’ screen to set those variables with a text string.

this is a new issue. new to the last day or 2

This is not happening on my android emulator or the live companion app. anybody that can help me please do! this is driving me nutz! I can’t figure it out.

@tatiang per your request, sir! the initialization blocks

as an update. i took out the variables and i dont experience the same issue. i am going to try to move the initialization and setting as a generic string to a ‘splash’ screen and will update.

***Update. when i initialize blocks on a splash screen and set them as a text variable, this fixes the crashing issue. (i actually deleted the original variables and set it as 1 variable with a list of text values) and now I am applying this to the bigger app and will get back with an update after downloaded and tested

here are the blocks i tested and will be implementing in my main app

Post a screenshot of the initialize blocks for those variables. The type is very important and it’s not shown above.

And if you’re initializing them to [no block] then what values are they set to the first time they are set to a value? Because I believe that then determines the type of variable they are from that point forward.

as always, thank you for your time and consideration!

Oops! Stored variables don’t get initialized as a type. I forgot that! And you’re welcome… I do what I can.

So it may be an issue with how the variables are set to their first values. Because it’s not happening consistently across device/preview experiences, I can’t know that for sure but it’s a hunch.

as an update. i took out the variables and i dont experience the same issue. i am going to try to move the initialization and setting as a generic string to a ‘splash’ screen and will update.

1 Like

It looks like you’re storing a text input value for each of those Stored variables. If so, are there any special characters (e.g. punctuation) that you’re inputting?

i haven’t been. just text. single letters for testing purposes.

When you had the variables included, were you seeing the last Alert in the list? If not, where was it crashing… which alert?

Edit: oh, nevermind… you’re right, they would only show if the input is empty.

so, the alerts showed if i left a text box blank only. i would see it then. if no text is blank, that’s when the crash occurs


Though the variables are initialized, they still don’t like being saved for some reason without being manually set as a text variable. So I do that with this code. The first time the user visits this screen, the variables are set as a text string. Then any other time, this step is bypassed and the screen just opens up. problem solved!

1 Like