Saturday, April 27, 2013

NSFileHandle readToEndOfFileInBackgroundAndNotifyForModes example ios


readToEndOfFileInBackgroundAndNotifyForModes:

Reads to the end of file from the file or communications channel in the background and posts a notification when finished.
- (void)readToEndOfFileInBackgroundAndNotifyForModes:(NSArray *)modes
Parameters
modes
The runloop modes in which the read completion notification can be posted.
Discussion of [NSFileHandle readToEndOfFileInBackgroundAndNotifyForModes]
See readToEndOfFileInBackgroundAndNotify for details of this method's operation. The method differs fromreadToEndOfFileInBackgroundAndNotify in that modes specifies the run-loop mode (or modes) in whichNSFileHandleReadToEndOfFileCompletionNotification can be posted.[NSFileHandle readToEndOfFileInBackgroundAndNotifyForModes]
You must call this method from a thread that has an active run loop.
Example of [NSFileHandle readToEndOfFileInBackgroundAndNotifyForModes]

[handle3 seekToFileOffset:0];
[handle3 readToEndOfFileInBackgroundAndNotifyForModes:[NSArray arrayWithObject:NSDefaultRunLoopMode]];