开发者

How to store data into an xml file on my website and extract the data out of it in my iphone app

In my application i need to create and save data into an xml file on my webspace and then i want to parse that xml into my iphone app. The question here is this is being done by two different parties a sender and a receiver. But i don;t know how to parse that xml file into my app when i don't have the excat url of that xml because there will be number of开发者_如何学运维 people who will be using this app so how i can allocate the xml a specific url and pass that url at receiver end.

Thanks,


As there is a lot to this question I can only give you a vague answer to keep it short. The type of communication I recommend using is NSURLConnection. That will allow you to get the contents of say an xml from a URL.

As far as identifying individual users there is a few ways all of them a fair bit of work. You could create a sign in where the user has a unique username or email. Store that in the database on your server and pass it as part of the url.

You could also sort of use push notification registration where your server is required to keep an iPhone unique identifier to push information to Apple. I don't know enough to push notification to give you much guidance in this but if you don't want the user to create an account I think this would be the way. You could also query the server for a unique ID and store it in NSUserDefaults.

I would recommend the user account creation though. Also have a look at NSXMLParser for your xml parsing.

Beyond this help ask a more specific question. There are also many other ways to do this, its just the way I do it.


I can help you with the parsing of the XML.

iOS (like mac) has a built in XML parser.

Still I would recommend you use an external library, there are several available out there.

In a recent project, I very successfully used TouchXML: http://github.com/schwa/TouchXML

Here is a very simple tutorial on how to use the TouchXML library to parse XML files:

http://foobarpig.com/iphone/parsing-xml-element-attributes-with-touchxml.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜