Domanda

I am trying to parse a podcast to build a table view of its contents in my app. The picture for the podcast is in a tag listed as:

<itunes:image href="http://www.site.com/picture.jpg" />

In my app, I try to get the contents of the string using:

 NSString *articleImage = [item valueForChild:@"itunes:image"];

When I run a log for this string, nothing shows up. So, how would I go about getting the URL of the jpg from this particular tag?

È stato utile?

Soluzione

The url is in an attribute called href, valueForChild gets the text value of the element, which is quite correctly empty. You want to use [item attributeForName:@"href"] where item is your itunes:image element.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top