0 Replies Latest reply on Oct 12, 2011 6:43 AM by Jason Moore

    Air3, Filestream, iPad , iPhone ,async writeBytes bug ?

    Jason Moore Level 1

      Hi All,

       

      Just a note of something untoward I've found when producing an iPad app.

       

      I was using a fileStream, opened asyncroniously to write data to the local file system. In Air 2.7 this worked perfectly but when I upgraded to Air 3.0 sdk it suddenly stopped working. After a bit of investigation, turns out if you call fileStream.writeBytes(myBytes) before the previous write has finished the filestream object breaks. The second write call dos'nt actually generate any error instead the fileStream object loses its properties - you get a get exception in the watcher on all the properties.

       

      To solve this I now have to implement a Q, write the bytes to a byteArray in memory, then write these to the filestream. Any bytes that I generate before the fileStream returns an outputProgress event I add to the Q in memory. When the fileStream returns a outputProgress event that shows it has finished, I then write from the Q again.. etc...

       

      As I said, all this worked perfectly in 2.7....

       

      Hope this helps someone.

       

      Message was edited by: Jason Moore Forget to mention this was an iPad App... ! A pretty important detail. So have updated the thread.