+stringWithContentsOfURL read-only?

  • I'm using +stringWithContentsOfURL:encoding:error: to load the contents of a file for simple parsing. Unfortunately, if that file is open somewhere else, I get:

    Error Domain=NSCocoaErrorDomain Code=257 "The file “Logs” couldn’t be opened because you don’t have permission to view it." UserInfo=0x7faf4a86c3a0 {NSFilePath=/Users/rmann/Desktop/Logs, NSUnderlyingError=0x7faf4a8065c0 "The operation couldn’t be completed. Permission denied"}

    I'm fairly sure that if I open the file read-only, I shouldn't have a problem.

    Can this be done?

    --
    Rick
  • Hrm. Seems I only sometimes get that error when opening a file...

    On May 13, 2012, at 15:26 , Rick Mann wrote:

    > I'm using +stringWithContentsOfURL:encoding:error: to load the contents of a file for simple parsing. Unfortunately, if that file is open somewhere else, I get:
    >
    > Error Domain=NSCocoaErrorDomain Code=257 "The file “Logs” couldn’t be opened because you don’t have permission to view it." UserInfo=0x7faf4a86c3a0 {NSFilePath=/Users/rmann/Desktop/Logs, NSUnderlyingError=0x7faf4a8065c0 "The operation couldn’t be completed. Permission denied"}
    >
    > I'm fairly sure that if I open the file read-only, I shouldn't have a problem.
    >
    > Can this be done?
    >
    > --
    > Rick
previous month may 2012 next month
MTWTFSS
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      
Go to today