代码之家  ›  专栏  ›  技术社区  ›  Steven Fisher

如何在[nsdata datawithcontentsofmappedfile:]之后检查错误?

  •  2
  • Steven Fisher  · 技术社区  · 14 年前

    我的项目中有以下代码:

    id mappedData = [dataWithContentsOfMappedFile: path]
    

    显然,如果 mappedData 是零,但没有成功。但是我怎样才能知道 为什么 它没有成功?没有 dataWithContentsOfMappedFile:withError: .

    1 回复  |  直到 14 年前
        1
  •  3
  •   John Calsbeek    14 年前

    -dataWithContentsOfFile:options:error: NSDataReadingMapped

    NSMappedRead