且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

速度:XML与NSUserDefaults

更新时间:2023-02-10 15:55:44

NSUserDefaults仅用于首选项,而不用于保存大量数据.NSUserDefaults被保存为plist(显然是xml格式),因此读写速度应该没有任何差异.我建议您将信息保存在documents文件夹内的plist中.还有CoreData(另存为SQLite)或SQLite.与plists或NSUserDefaults相比,这两种方法都更难以实现.

NSUserDefaults is ment just for preferences, not for saving a lot of data. NSUserDefaults are being saved in a plist (xml format, obviously) so there shouldn't be any difference in reading and writing speed. I would recommend you to save the information in a plist inside your documents folder. Aswell there is CoreData (which is saved as SQLite) or SQLite. Both of it is more difficult to implement than plists or NSUserDefaults.