Reading large files from NSInputstream is not working in ios
over 7 years agoAnswer it
over 7 years ago
I think you should call - (NSInteger)read:(uint8_t *)buffer maxLength:(NSUInteger)len to get max length of data instead of fetching it in small chunks. If you use "max:read" method for length then other run loop tasks will be allowed to run before the next HasBytesAvailable event is delivered. If you do not read all of the available data then you will receive another HasBytesAvailable event which will give you problem while fetching data.
For more help:- http://stackoverflow.com/questions/29224004/is-calling-readmaxlength-once-for-every-nsstreameventhasbytesavailable-correct