Saturday, April 27, 2013

NSFileHandle synchronizeFile example ios


synchronizeFile

Causes all in-memory data and attributes of the file represented by the receiver to be written to permanent storage.
- (void)synchronizeFile
Discussion of [NSFileHandle synchronizeFile]
This method should be invoked by programs that require the file to always be in a known state. An invocation of this method does not return until memory is flushed.
Example of [NSFileHandle synchronizeFile]
NSFileHandle *fileHandle = [NSFileHandle fileHandleForWritingAtPath:filename];
...
[fileHandle writeData:dataComeInFromURLConnection];
...
[fileHandle synchronizeFile];