How do I check for an error after [NSData dataWithContentsOfMappedFile:]?
-
27-09-2019 - |
문제
I have this code in my project:
id mappedData = [dataWithContentsOfMappedFile: path]
Obviously, if mappedData
is nil it didn't succeed. But how can I get details about why it didn't succeed? There's no dataWithContentsOfMappedFile:withError:
.
해결책
Use -dataWithContentsOfFile:options:error:
, passing the NSDataReadingMapped
constant in the options parameter.
(This constant is known as NSMappedRead
if you're not compiling against the iOS 4.0 SDK.)
제휴하지 않습니다 StackOverflow