I am trying to get latest data from a RSS URL and show its content in Today Widget extension , with RSSParser
but the problem is it returns null ! here is my codes :
- (void)viewDidLoad {
[super viewDidLoad];
NSURLRequest *req = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:@"http://myBlog.net/?feed=rss2"]];
[RSSParser parseRSSFeedForRequest:req success:^(NSArray *feedItems) {
[self setDataSource:feedItems];
} failure:^(NSError *error) {
[self setTitle:@"Error"];
NSLog(@"Error: %@",error);
}];
item = [self.dataSource objectAtIndex:0];
//this returns null:
NSLog(@"Title is %@",[item title]);
NSLog(@"Widget Runs");
}