views:

24

answers:

1

I have an application which binds a map with user's location, 2 pictures and some text in the xml file and send it to the other user through email. Now the question is that if the other user who is receiving it, how i should make this xml file parsed in my application so that the receiver can have a sensible look of the data like the map with two tabs (pictures and comments). The basic question is how i can read the sent xml file at receiver's end.

Thanks,

A: 

At the sender's end, create an NSDictionary containing the location, the data of the two UIImages and the NSString. Then, save it as a plist, and send it via email. Then, at the receiver's end, create an NSDictionary with the contents of the file (NSDictionary *dataDict = [[NSDictionary alloc] initWithContentsOfFile:YOUR_FILE];), and then get the objects using the relevant keys that you set for them when you added them to the dictionary.

Hope this helps,
jrtc27

jrtc27
how could i start my app at receiver's end??
Ashutosh
You could use a custom URL sceme - see [here](http://developer.apple.com/library/ios/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/StandardBehaviors/StandardBehaviors.html#//apple_ref/doc/uid/TP40007072-CH4-SW50) for more detail, or you could use a custom document - see [here](http://developer.apple.com/library/ios/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/StandardBehaviors/StandardBehaviors.html#//apple_ref/doc/uid/TP40007072-CH4-SW12) for more detail.
jrtc27
Yes i am aware about the custom URL scheme but the thing is i need to open the part of the application which parses the xml file and dispay the data at receiving end.
Ashutosh
because i am sending the data through iphone Email how would i access the xml file and parse it in my application.
Ashutosh
You can register your application to accept the `plist` file format, and then open your application with the file as the argument (note that this is only in iOS 4+).
jrtc27