DOUAudioStreamer icon indicating copy to clipboard operation
DOUAudioStreamer copied to clipboard

手机内存空间不够了的情况会crash

Open Arvin-J opened this issue 8 years ago • 2 comments

[[NSFileHandle fileHandleForWritingAtPath:_cachedPath] truncateFileAtOffset:_expectedLength];

Arvin-J avatar Mar 01 '16 08:03 Arvin-J

Exactly the same crash!

jaybowang avatar Mar 01 '16 12:03 jaybowang

Exception message:

exception NSException * name:@"NSFileHandleOperationException" reason:@"*** -[NSConcreteFileHandle truncateFileAtOffset:]: No space left on device" 0x170d2560

And use @try can avoid this crash.

  @try {
    [[NSFileHandle fileHandleForWritingAtPath:_cachedPath] truncateFileAtOffset:_expectedLength];
  }
  @catch (NSException *exception) {
    // or use NSFileHandleOperationException instead of NSException
    NSLog(@"%@",exception.reason);
  }

jaybowang avatar Mar 02 '16 09:03 jaybowang