iosobjective-cnsfilehandle

Do I need to close an open NSFileHandle while concurrently reading the file in a different source?


I'm logging data to a file that I keep open with NSFileHandle. These log files can be emailed out, is it necessary to close NSFileHandle before I send the email


Solution

  • You don't need to close the file handle but if you want everything that has been written so far, you should call synchronizeFile on the file handle to ensure anything in memory has been written to the file.