문제

Example:

NSData *fileData = [fileHandle readDataToEndOfFile];

Am I responsible for closing that file handle? (I think I'm not...but just 99.95% sure!)

도움이 되었습니까?

해결책

You are not required to close the file handle, however, it is good practice to deallocate the NSFileHandle object when you are finished with it. This will ensure that the memory used by the application is kept to a minimum.

iOS Class Reference:

Note: The deallocation of an NSFileHandle object deletes its descriptor and closes the represented file or channel unless the NSFileHandle object was created with initWithFileDescriptor: or initWithFileDescriptor:closeOnDealloc: with NO as the parameter argument.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top