1 Reply Latest reply on Jun 14, 2011 3:03 AM by luke3design!!

    Overwrite a sqlite file on iOs (iPad)

    luke3design!! Level 1


           I'm developing an application that will be deployed on iPad.

      In the application I have a local sqlite database that has to be synchronised with the online version.

      At application startup I check if the sqlite database is synchronised, if not I download it and overwrite the old database.

      When I test the application inside flash builder there aren't any errors, but when deploying the application to iPad and run the debug I get this error when the application makes attempt to overwrite the sqlite database file:


      Error: Error #3001: File or directory access denied.
          at flash.filesystem::FileStream/open()
          at Function/dial.model:Corsi/private:downloadDbComplete/dial.model:onCloseDb()[corso/src/dial/model/Corsi.as:133]
          at flash.data::SQLConnection/internalClose()
          at flash.data::SQLConnection/close()
          at dial.model::Corsi/downloadDbComplete()[corso/src/dial/model/Corsi.as:141]
          at flash.events::EventDispatcher/dispatchEventFunction()
          at flash.events::EventDispatcher/dispatchEvent()
          at flash.net::URLLoader/onComplete()


      Before overwrite the file I close the connection to the sqlite database.

      To overwrite the file i use this code:


      var dbString:String=File.applicationDirectory.nativePath.toString()
      var db:File=new File(dbString)
      var stream:FileStream=new FileStream()
      stream.writeBytes(e.target.data)   //e.target.data is the sqlite file download through the urloader class


      This error is really driving me crazy.

      Has anyone encountered a similar error?

      Any ideas on how to let it work?

      Thanks in advance



      I also tried to delete the file, but when i call db.deleteFile() the debugger traces that "is not a file"....