title: NSFileHandle fileHandleForWriting returns nil, error code 24
body: <p>I've got a method in my app that writes a string to the end of a file:</p>
  
  <pre><code>-(void)log:(NSString *)str
  {
    if (![[NSFileManager defaultManager] fileExistsAtPath:self.logPath])
      [[NSFileManager defaultManager] createFileAtPath:self.logPath contents:nil attributes:nil];
  
    NSError *err = nil;
  NSFileHandle *myHandle = [NSFileHandle fileHandleForWritingToURL:[NSURL fileURLWithPath:self.logPath] error:&amp;err];
  if (!myHandle)
      NSLog(@"Failed to write file - %@", err.localizedDescription);
    [myHandle seekToEndOfFile];
    [myHandle writeData:[str dataUsingEncoding:NSUTF8StringEncoding]];
    [myHandle closeFile];
  }
  </code></pre>
  
  <p>It works for a while and then starts failing; <code>fileHandleForWritingToURL</code> returns <code>nil</code>.  The error I get is NSCocoaErrorDomain error 24.  But I can't find any reference to this error anywhere.  Google is no help.  Has anyone seen this before?  Am I doing something wrong?</p>