Saturday, April 27, 2013

NSFileHandle readInBackgroundAndNotifyForModes example ios


readInBackgroundAndNotifyForModes:

Reads from the file or communications channel in the background and posts a notification when finished.
- (void)readInBackgroundAndNotifyForModes:(NSArray *)modes
Parameters
modes
The runloop modes in which the read completion notification can be posted.
Discussion of [NSFileHandle readInBackgroundAndNotifyForModes]
See readInBackgroundAndNotify for details of how this method operates. This method differs fromreadInBackgroundAndNotify in that modes specifies the run-loop mode (or modes) in which NSFileHandleReadCompletionNotification can be posted.
You must call this method from a thread that has an active run loop.
Example of [NSFileHandle readInBackgroundAndNotifyForModes]

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