应用程序发布时,如何将属性列表放入我的应用程序的文档文件夹中?
我的应用程序中有多个表格视图,每个表格视图的数据源都是属性列表。目前我已将属性列表保存在应用程序包中。然而,那只是因为我在 XCode 中创建了它们,并且它们自动保存在文档文件夹中。这很好,因为当应用程序发布时,那就是它们需要的地方。
但是,我想在发布时将属性列表的副本放入我的应用程序的文档文件夹中。我怎样才能做到这一点?我的意思是我可以对 XCode 进行编程来保存我手动创建的 pList 以保存在我的应用程序的文档文件夹中吗?或者说这是如何运作的?基本上总结一下,我想在应用程序包和文档文件夹中各放置一份属性列表的副本,
我感谢任何人提供的帮助。
谢谢
I have several tableviews in my app and the data source for each tableview is a property list. Currently I have the propertylists saved in the application bundle. However, thats only because I created them in XCode and they are automatically saved in the documents folder. This is fine as when the app ships, thats where they need to be.
However, I would like to put a copy of the property lists in the documents folder of my app as well when it ships. How can I do that? I mean Can I program XCode to save the pLists I create manually to save in the documents folder of my app? Or how does that work? Basically to summarize, I would like to put a copy of the propertylist each in the application bundle and the documents folder
I appreciate any help anyone provides.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你不能。当应用程序首次运行时,您必须通过检测文件不存在或检查 NSUserDefaults 中的标志来复制文件。
You can't. You would have to copy the file over when the app is first run, either by detecting that the file doesn't exist or by checking a flag in NSUserDefaults.