开发者

saving/reading text

开发者 https://www.devze.com 2023-01-22 07:20 出处:网络
I have to save about 1kb of text. The text is not updated very often (about once a month). But is read once every time the app is started.

I have to save about 1kb of text. The text is not updated very often (about once a month). But is read once every time the app is started.

Would saving it to NSUserDefaults slow down the reading/writing from/to NSUserDefault? Would it 开发者_开发知识库be better to save it to a text file in the documents folder?

Thanks in advance!


I'll give my 2¢ that 1kb seems kind of "heavy" for NSUserDefaults usage.

Considering NSUserDefaults syncs periodically, you might be better off placing said text in the User's Documents directory.


My guess is that you won't ever know the difference. Just put it in the defaults. If you want to be sure, do a benchmark test.

0

精彩评论

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