更新文件共享文件夹中的 plist 文件 - 我真的需要建议
我需要打开位于文件共享文件夹中的 plist 文件,以便在每次启动应用程序时添加两条用户信息;如用户的新名称和电子邮件(两者都是 NSString 类型,plist 文件是 Dictionary)。
然后需要再次将文件保存回文件共享文件夹,以便稍后可以通过 iTunes 删除新更新的 plist 文件。
如果有人可以提供帮助,将不胜感激
I need to open a plist file located in the File Sharing folder, to add two pieces of user info to each time the app is launched; as in a new Name and Email of the user (both are of type NSString and the plist file is Dictionary).
It then needs to save the file back to the File Sharing folder again, so that the new updated plist file can be removed at a later time via iTunes.
If anyone could help it would be greatly appreciated
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
可以将 plist 存储在 Documents 目录中。您将能够将 plist 加载到 NSMutableDictionary 中,修改字典并将其写回 Documents 目录。
我不知道您是否能够通过 iTunes 删除该 plist。
Storing a plist in the Documents directory is possible. You will be able to load the plist into an NSMutableDictionary, modify the dictionary and write it back out to the Documents directory.
I don't know that you will be able to remove the plist via iTunes.
我发现的另一个很棒的资源是“Humble Coder”博客的一篇文章,位于以下位置。很好的建议,示例代码非常适合我保存、检索和更新 plist 文件的需要。再次感谢那些提供帮助的人。
http://humblecoder.blogspot.com/2010/03/重新访问-存储和检索.html
Another great resource that I found was an article by the "Humble Coder's" blog at the following location. Great advice and the example code was spot on for my need to save retrieve and update my plist files. Thank you again to those that helped.
http://humblecoder.blogspot.com/2010/03/revisited-storing-and-retrieving.html