0

I have a problem. I have created an IOS application that will send read only document via mail.

I use this code to protect the file

NSData *fileContent = [manager contentsAtPath:path];
NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
[dict setObject:[NSNumber numberWithBool:YES] forKey:NSFileImmutable];
[dict setObject:[NSNumber numberWithShort:0444] forKey:NSFilePosixPermissions];
[manager createFileAtPath:alternativePath contents:fileContent attributes:dict];

I have checked the generated file and the permissions are all setted to "Read Only". When i send it via mail to someone, the file will be downloaded and then the owner can add annotation and other things..... How can i do to mantain the 444 file permission (read only) to the downloaded file??

Best regards

Francesco

Corey1986
  • 73
  • 1
  • 6

1 Answers1

1

This makes the file read only on your local file system, but file system meta data like this (such as permissions) will not transfer via an e-mail attachment.

Certain files (like PDF's) can be set to be read only and/or unchangeable, but once the file is off your device, the receiver can (attempt to) do anything they want with the content.

Community
  • 1
  • 1
Michael Dautermann
  • 88,797
  • 17
  • 166
  • 215
  • Thank you Michael, there aren't api or some libraries that can protect the content?? – Corey1986 Jun 07 '13 at 15:39
  • What ***is*** the content? If it's a PDF file, then yes there's a solution. – Michael Dautermann Jun 07 '13 at 15:41
  • the question I linked to shows how to set up a PDF file to have protected content – Michael Dautermann Jun 07 '13 at 16:07
  • When i use this method if i send it via mail, it will be editable if the user download it via mail..I need something that can assure me that the user can't edit the downloaded pdf (In .Net i was using iTextSharp and it was working very well).. Thank you Michael – Corey1986 Jun 07 '13 at 16:14