Lock file on iOS Device programmatically
I want to lock a file (located in the Documents directory of my Application Bundle) programmatically using a password. Is there an API for that, or do开发者_StackOverflow i have to write my own encryption and decription mechanism?
I've allready searched on the internet, but i couldn't find the proper solution for my problem.
To be clearly, i want to store a NSDictionary to a file located in the Documents directory. There i'd simply use NSDictionary's method writeToFile:atomically:
but there is no possibility to set a password?
Thanks for your help, Br Nic
You can do that in two steps:
convert your NSDictionary to NSData by using NSKeyedArchiver archivedDataWithRootObject
encrypt/decrypt your NSData like explained in this S.O. topic
精彩评论