I have an error reading XML files for my iPhone application. I have a new feature in an iPhone app that reads my RSS feed. Everything looks good, but I have this problem:
Error loading rss. Check your internet connection.
Here is my code:
- (BOOL) readRSS { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; [UIApplication sharedApplication].networkActivityIndicatorVisible = YES; [[NSURLCache sharedURLCache] setMemoryCapacity:0]; [[NSURLCache sharedURLCache] setDiskCapacity:0]; BOOL success = NO; NSXMLParser *parser = nil; NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"http://rss.domain.com/%@.xml", self.currentPage]]; parser = [[NSXMLParser alloc] initWithContentsOfURL:url]; [parser setDelegate:self]; [parser setShouldProcessNamespaces:NO]; [parser setShouldReportNamespacePrefixes:NO]; [parser setShouldResolveExternalEntities:NO]; success = [parser parse]; [parser release]; [pool drain]; return success; }
Then I have this code:
- (void) cleartbl:(NSInteger)type { [[[self rssParser] rssItems] removeAllObjects]; [_tableView reloadData]; if(type == 1) { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"RSS Feed" message:@"Error while loading rss. Please check your Internet connection." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil]; [alert show]; [alert release]; }
Then I assign:
if([elementName isEqualToString:@"title"]){ self.currentItem.title = self.currentItemValue; }
What is my problem, am I missing something?
source share