Question

I am trying to upload images to yFrog which is working just fine, but I want to grab just the URL from the response. When I use the NSURLConnection method

- (void) connectionDidFinishLoading:(NSURLConnection *)connection {
[connection release];


NSString* responseString = [[NSString alloc] initWithData:webData  
encoding:NSUTF8StringEncoding];

// NSString *url = [webData valueForKey:@"mediaurl"];
NSLog(@"result: %@", responseString);
}

I get this as my response string

result: <?xml version="1.0" encoding="UTF-8"?>
<rsp stat="ok">
<mediaid>hszuhsp</mediaid>
<mediaurl>http://yfrog.com/hszuhsp</mediaurl>
</rsp> 

As you can see in my blocked out code I tried to give my NSMutableData to give me the value of the key @"mediaurl" which just crashes. I think this should be relatively easy but for some reason I just can not figure out how to just grab the URL out of the response. Any help would be greatly appreciated. Thank you

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top