Skip to main content
Inspiring
November 20, 2013
Question

iOS simulator doesn't seem to enable writing to disk?

  • November 20, 2013
  • 1 reply
  • 1027 views

Hey,

Am trying to test our latest app on iOS6.1 via the iOS simulator.

Problem is that we don't seem able to write anything to disk.

We have several shared objects which we can't 'flush' plus, when we try to write a file to disk we also get a fault.

The app works fine on actual iOS devices so I know our code is correct.

Has anyone else experienced this kind of issue?

I can't find any documentation to suggest we can't write to disk from the simulator so am a bit stumped!

Any ideas or advice greatly appreciated!

Thanks.

This topic has been closed for replies.

1 reply

Colin Holgate
Inspiring
November 20, 2013

I just double checked, and my games seem to save the sharedobject ok in the Simulator. I don’t see anywhere that you can set it to be read only.

One thing though, I think that some user bug reports were caused by real devices failing to flush ok. These days I do the flush using a try/catch approach, so that if the save fails at least the app will continue to run:

try {

sharedobj.flush();

} catch (err) {

trace(err);

}

That might also help you to see what the error was.

DaveCatesAuthor
Inspiring
November 20, 2013

Hi Colin,

Yeah, I tried that and all I get is:

Error #2130: Unable to flush SharedObject.

Also, on the writeBytes function on a FileStream I get:

Error: Error #0

So...doesn't look like I'm doing anything wrong but...why doesn't the simulator let me write to the application storage? Or am I misunderstanding the situation?

Anything I should have added to the app descriptor xml? Can't think of anything though considering the app works fine on a physical device.

Am using Air 3.9 and FB 4.6 ...all usual standard stuff. Latest Xcode too.

DaveCatesAuthor
Inspiring
November 21, 2013

Not sure why but, after uninstalling xcode completely and re-installing it everything works fine now.

Most odd.

Thanks Colin for your reply though.