如何检查 [NSData dataWithContentsOfMappedFile:] 之后的错误?
我的项目中有这段代码:
id mappedData = [dataWithContentsOfMappedFile: path]
显然,如果mappedData
为nil,则它没有成功。但我怎样才能获得为什么它没有成功的详细信息呢?没有 dataWithContentsOfMappedFile:withError:
。
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:
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用
-dataWithContentsOfFile:options:error:
,在 options 参数中传递NSDataReadingMapped
常量。(如果您不是针对 iOS 4.0 SDK 进行编译,则此常量称为
NSMappedRead
。)Use
-dataWithContentsOfFile:options:error:
, passing theNSDataReadingMapped
constant in the options parameter.(This constant is known as
NSMappedRead
if you're not compiling against the iOS 4.0 SDK.)