Replace obsolete data for NSData withContentsOfMappedFile

So the + (id) dataWithContentsOfMappedFile: (NSString *) path is apparently not recommended with iOS 5.0. It sounds to me as if I should avoid using it, but then what should I use instead?

I used mmap to create memory mapped files and worked with iOS5, but something was wrong in iOS6 because I get an error message as soon as I try to update or read the buffer.

  int fd = open(path, O_RDWR);
  off_t offset = 0;
  snapshotData = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, offset);
  close(fd);
+5
source share
1 answer

+dataWithContentsOfFile:options:error:. NSDataReadingMappedIfSafe . NSDataReadingMappedAlways , , . , NSDataReadingMappedAlways , . , , CIMG.

+10

All Articles