简体   繁体   English

如何保存XML文件?

[英]How to save an XML file?

I am developing an application. 我正在开发一个应用程序。 In it, I want to create an XML file with some data. 在其中,我想创建一个包含一些数据的XML文件。 I want to save the XML file and retrieve it at some other time. 我想保存XML文件并在其他时间检索它。 Is it possible to save and retrieve an XML file on the iPhone? 是否可以在iPhone上保存和检索XML文件? If so, how? 如果是这样,怎么办?

You could use NSUserDefaults with some NSDictionaries or NSArrays. 您可以将NSUserDefaults与某些NSDictionaries或NSArrays一起使用。 It's basically the same stuff. 基本上是一样的东西。 NSUserDefaults writes some NSArrays or NSDictionary to the app folder on your device as an XML (Plist file). NSUserDefaults将一些NSArrays或NSDictionary作为XML(Plist文件)写入设备上的app文件夹。

The good thing is that it will be persistent during app lauches. 好消息是它在应用启动时将是持久的。 Have a look here . 在这里看看。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM