Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 NSCoder 对一些 NSDictionary 进行编码,并且我想以某种方式将其保存在应用程序中。谁能告诉我我该怎么做?
我想让用户能够在打开应用程序时查看他之前所做的事情。
您可以将其写入 Application Support 文件夹中的文件,或者如果文件很小,您可以将其放入NSUserDefaults. 但是,对于其中任何一个,如果字典只包含属性列表类型,您可以直接编写字典。您不必将其编码为NSData第一个。
NSUserDefaults
NSData