Codea App Erases Project Data when Closed

Greetings! I’ve been having a problem with my Codea app where the project data is erased when ever I close the app on my device that Im testing it on (also through test flight). Has any had this problem before or know a cause of it?

@Goatboy76 what iPad do you have? I’ve not come across this erasure problem, is this on Xcode built applications?

@ Luatee This problem is on all of the devices that I’ve tested it on. iPad 4, iPhone 5 and iPad 2. Yes. This problem occurs when I move my app to Xcode but the data saves fine in Codea.

Probably worth seeing what @Simeon has to say, could be an issue with the runtime update. What functions are you using to save project data?

@Luatee Im using saveProjectData

I’ve tried a combination of erasing the data before exporting and the such but no dice.

@Goatboy76 try using saveLocalData, I’m pretty sure saveProjectData is for Codea only.

@Luatee Ill try that out

@Luatee YES! It worked! <:-P <:-P <:-P Thanks!

@Simeon I suggest you make a note in the Codea reference that projectData doesn’t work outside of the Codea app. It can be a hard bug to track down.

Glad it helped :slight_smile: It was mentioned in a thread earlier on when the function was implemented in to Codea, not sure if it’s mentioned in the reference.

Sorry @Goatboy76, we should be more explicit about this.

Writing project-local assets and data is not supported in exported projects, because exported projects make the .codea project read-only by including it within the app bundle (rather than the app sandbox).

ha. That explains why i cant change a tab content in an exported app from within…

@Simeon Ok, thanks.