I've been digging into an RSS news feed reader. I'm running into a problem when I change from one feed to another.
The tutorial:
http://www.touch-code-magazine.com/tutorial-building-advanced-rss-reader-with-ios6/
I wanted to do things like read different feeds and be able to add new ones as needed. I'm new to XML and it seems I'm having a problem with different data structures being returned.
Is there a universal routine to read different news feeds or do you have to know the structure in advance?
Is there a getStructureFromXML() function somewhere, so I can at least get an idea of the structure that's coming in?
Or maybe a routine that will make an array and load it in whatever the structure is?
BTW, theres a weak spot in the tutorial code:
Will crash if the string is < 100, this will fix it:
The tutorial:
http://www.touch-code-magazine.com/tutorial-building-advanced-rss-reader-with-ios6/
I wanted to do things like read different feeds and be able to add new ones as needed. I'm new to XML and it seems I'm having a problem with different data structures being returned.
Is there a universal routine to read different news feeds or do you have to know the structure in advance?
Is there a getStructureFromXML() function somewhere, so I can at least get an idea of the structure that's coming in?
Or maybe a routine that will make an array and load it in whatever the structure is?
BTW, theres a weak spot in the tutorial code:
Code:
NSString* itemDescription = [NSString stringWithFormat:@"%@...", [self.itemDescription substringToIndex:100]];
Will crash if the string is < 100, this will fix it:
Code:
NSString* itemDescription = @"*Error* Description Too short...";
if (self.itemDescription.length > 20)
{
itemDescription = [NSStringstringWithFormat:@"%@...", [self.itemDescriptionsubstringToIndex:MIN(100,self.itemDescription.length-1)]];
}