I am trying to access a personally hosted web service that passes back XML output but only if valid user credentials are passed along with the request.
Say for example something like this
<?php
check_cred($_POST["uname"], $_POST["key"]);
If everything is good it will hand back XML. But Im not sure how to pass along the username and key in the Swift
func startConnection(){
// Add user information to send to example.com here?
var url = NSURL(string: "http://example.com/")
var xmlParser = NSXMLParser(contentsOfURL: url)
xmlParser?.delegate = self
xmlParser?.parse()
}
func parser(parser: NSXMLParser!, didStartElement elementName: String!, namespaceURI: String!, qualifiedName qName: String!, attributes attributeDict: NSDictionary!) {
println("Element's name is \(elementName)")
songList.append(elementName)
tableView.reloadData()
}
If anyone knows a better method for doing something like this that would be smarter than my current approach, I'd be happy to hear that as well. Basically the idea is to hit a url, get a list of song titles-artists and toss it into a table view.
No comments:
Post a Comment