开发者

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:

  1. convert your NSDictionary to NSData by using NSKeyedArchiver archivedDataWithRootObject

  2. encrypt/decrypt your NSData like explained in this S.O. topic

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜