Reputation:
I want to download data from HTTP using username and password for authentication using objective-c. And want to download the data which will be returned. And want to parse it for usage, like if the data gets downloaded successfully a new screen will be opened and if data could not be downloaded it would take me to another screen.
Please let me know if there is any full tutorial related to this or let me know how can I do this .. ?
thanks in advance
Upvotes: 3
Views: 636
Reputation: 7733
Use the connection delegate
- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
{
// To get into a new view controller. Push the newviewcontroller with the help of navigation controller.
}
and use the parsing delegate
- (void)parserDidEndDocument:(NSXMLParser *)parser
{
//To use the parsing data to be displayed in other view controller.Push the Otherviewcontroller with the help of navigation controller.
}
Upvotes: 0
Reputation: 830
You should definitely check out Apple's SeismicXML code, it is really simple to follow and uses classes native to apple. In this example, an RSS feed is downloaded and displayed by parsing the XML. I am using this modified code to query Amazon and download product information. Check it out here: http://developer.apple.com/library/ios/#samplecode/SeismicXML/Listings/ReadMe_txt.html
I hope this helps!
Upvotes: 1