iphone - How to parse different files depending on the current date in Xcode? -


i have following problem: building app tv guide. parsing listing channels xml file on internet. code:

-(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];      (tfhppleelement *element in arraylisting)     {         listing *shows = [[listing alloc] init];         [newarraylisting addobject:shows];         shows.broadcast = [[element firstchild] content];     }      _shows = newarraylisting;     [self.tableview reloaddata]; } 

look @ first row - file's name /.../01.04.2013.xml tomorrow's file /.../02.04.2013.xml , etc. how make parse different files depending on current date? this: today parses /.../01.04.2013, tomorrow parse /.../02.04.2013 , etc. ? in advance!

  1. first of all, today's date same format used in url. (you have play separate date, month , year components)

  2. then, convert date nsstring object

  3. form nsstring nsstring *strtoday = [nsstring stringwithformat:@http://pik.bg/tv/bnt1/%@.xml",strtoday];

  4. use string nsurl, like; nsurl *urllisting = [nsurl urlwithstring:strtoday];

note solution work if url contains date format specified you.


Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -