1

i am trying to unpack a .zip file but when i try to copy the zip stream to the file i get:

UnauthorizedAccessException: Access to the path "/var/mobile/Applications/7209CA86-E88D-4BAC-B285-2912B982E8C0/Documents/Inbox/Book.txt" is denied.
  at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) [0x00000] in <filename unknown>:0 
  at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize) [0x00000] in <filename unknown>:0 
  at System.IO.File.Create (System.String path, Int32 bufferSize) [0x00000] in <filename unknown>:0 
  at System.IO.File.Create (System.String path) [0x00000] in <filename unknown>:0 

Book.txt is a file of the .zip file.

Here is the code where the problem appears:

using (FileStream streamWriter = File.Create(fullZipToPath)) {
                    StreamUtils.Copy(zipStream, streamWriter, buffer);
                }

The code works well on OS X but on iOS i can't get it fixed. What is the problem?

Alex
  • 10,869
  • 28
  • 93
  • 165
  • where are you unzipping the files to? Since you're doing this on a phone, you'll need to use `Application.persistentDataPath` as the destination probably. – Steven Mills Jan 10 '14 at 12:48
  • the path is ok, it's checked. @StevenMills – Alex Jan 10 '14 at 13:32
  • I meant that on phones, apps have very restricted access to folders and files. There's only specific folders they can can read/write, so you'll probably need to use one such as the one I mentioned above, which you should have access to. – Steven Mills Jan 10 '14 at 13:49

0 Answers0