문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top