Bitnock / BNRSSFeedParser

Simple RSS and podcast parsing in Objective-C
https://github.com/Bitnock/BNRSSFeedParser
MIT License
22 stars 3 forks source link

Get crash when try parse into loop #7

Open torcelly opened 9 years ago

torcelly commented 9 years ago

Hello,

I always get crash when I try to parse into a loop and the feed has wrong format. For instance:

     NSURL *url1 = [NSURL URLWithString:@"http://www.relay.fm/cortex/feed"];
    NSURL *url2 = [NSURL URLWithString:@"http://feeds.wnyc.org/onthemedia"]; // has wrong format

    NSArray *podcastArray = @[url1, url2];

    for (NSURL *podcastURL in podcastArray) {
          BNPodcastFeedParser *parser = [[BNPodcastFeedParser alloc]init];
        [parser parseFeedURL:podcastURL withETag:nil untilPubDate:nil success:^(NSHTTPURLResponse *response, BNPodcastFeed *feed) {
               NSLog(@"Success");
        } failure:^(NSHTTPURLResponse *response, NSError *error) {
               NSLog(@"Failure");
        }];
    }

If all podcast in the loop are success, there isn't problem. But If one feed response failure ("http://feeds.wnyc.org/onthemedia" do it), the failure block, we get a EXC_BAD_ACCESS in the line 97, BNRSSFeedParser.m file.

I'm trying to debug and find a solution. Could you help me?

Thanks

farski commented 9 years ago

Since iOS 8 there have been several problems with NSXMLParser that erratically cause it to misbehave when parse is called. Malformed feeds should not cause a crash, but sometimes they do. Well-formed also obviously shouldn't cause any issues, but as you can see in #2 there are occasionally issues there as well.

I don't know when I'll get a chance to debug this specific feed, but if you could try to narrow down what part of the feed is causing the problem that may help. Maybe you could make a copy of the feed and eliminate parts of it until it stops crashing.