(NSStreamStatus)NSStreamEventErrorOccurred
edit
Probably the correct way to handle this is to replace the NSStreamEventErrorOccurred
with NSStreamStatusError
. That's probably what the author of ASIHTTP intended.
Question
I used ASIHTTPRequest
in my project,but in the file ASIDataCompressor.m
line 190
:
if ([inputStream streamStatus] == NSStreamEventErrorOccurred) {
if (err) {
*err = [NSError errorWithDomain:NetworkRequestErrorDomain code:ASICompressionError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"Compression of %@ failed because we were unable to write to the destination data file at %@",sourcePath,destinationPath],NSLocalizedDescriptionKey,[outputStream streamError],NSUnderlyingErrorKey,nil]];
}
[compressor closeStream];
return NO;
}
it warning me this:
Any one know how to fix it? thx
Solution
(NSStreamStatus)NSStreamEventErrorOccurred
edit
Probably the correct way to handle this is to replace the NSStreamEventErrorOccurred
with NSStreamStatusError
. That's probably what the author of ASIHTTP intended.
OTHER TIPS
NSStreamEventErrorOccurred
is of type NSStreamEvent
with a constant value of 8
. The streamStatus
method returns an NSStreamStatus
not NSStreamEvent
and NSStreamStatus
values do not exceed a value of 7
which is why you got the error. You were fortunate that 8 exceeded the bounds and you got an error because that not is always the case, therefore, you should always be cautious of the return type.