我有以下问题:我正在构建一个应用程序,它是一个电视指南。我正在解析互联网上xml文件中的频道列表。这是我的代码:如何根据Xcode中的当前日期解析不同的文件?
-(void)loadListing
{
NSURL *urlListing = [NSURL URLWithString:@"http://pik.bg/TV/bnt1/29.03.2013.xml"];
NSData *webDataListing = [NSData dataWithContentsOfURL:urlListing];
NSString *xPathQueryListing = @"//elem/title";
TFHpple *parserListing = [TFHpple hppleWithXMLData:webDataListing];
NSArray *arrayListing = [parserListing searchWithXPathQuery:xPathQueryListing];
NSMutableArray *newArrayListing = [[NSMutableArray alloc] initWithCapacity:0];
for (TFHppleElement *element in arrayListing)
{
Listing *shows = [[Listing alloc] init];
[newArrayListing addObject:shows];
shows.broadcast = [[element firstChild] content];
}
_shows = newArrayListing;
[self.tableView reloadData];
}
看第一行 - 我的文件的名称是/.../01.04.2013.xml 明天的文件将/.../02.04.2013.xml等 如何根据当前日期来解析不同的文件?像这样:今天解析/.../01.04.2013,明天将解析/.../02.04.2013等?提前致谢!
找出当前的日期,然后传递当前日期urlString串..... –