xml - How can I call an NSMutableArray created in another class? -
i have created 1 class xmlparsing.h/m, loads url, parses xml nsstrings , nsnumbers, , puts parsed strings nsmutablearray called "showarray".
the xml set each child has "id", , other variables. in array, have:
nsnumber: (the id xml) nsstring: (title) nsstring: (description) nsstring: (venue)
in class, showdetailviewcontroller.h/m, want load array , it's objects, and, based on tableview cell clicked in previous view, items in nib (labels in case) populated "id-specific" data xml. so, instance:
in tableview, titles of each show listed (from xml). user clicks on title, , view pushed, displays show's title, description, , venue, loaded parsed xml.
all of parsed data exists in nsmutablearray, problem is, can't seem access objects in class. array keeps returning null.
i have tried:
in showdetailviewcontroller.m, have 1 method contains:
xmlparsing *xmlclass = [[xmlparsing alloc] init]; nslog(@"the array contains: %@", xmlclass.showarray); [xmlclass release];
however, result "the array contains: (null)" if run same nslog within xmlparsing class itself, print entire array. so, know data parsing strings fine, , being stored in array. however, it's not accesible outside of class in made.
in xmlparsing class, have made nsmutablearray *showarray, non-atomic, retained, , synthesized property. going wrong?
thanks in advance help!
try in xmlparsing class
-(nsmutablearray *)parseurl { self.showarray = [[nsmutablearray alloc]init]; nsstring *geturlstring = @"url" nsurl *xmlurl = [nsurl urlwithstring:geturlstring]; xmlparser = [[nsxmlparser alloc] initwithcontentsofurl:xmlurl]; [xmlparser setdelegate:self]; [xmlparser parse]; return showarray;
}
in showviewcontroller class
xmlparsing *xmlclass = [[xmlparsing alloc] init]; anyarray = [xmlclass parseurl];
Comments
Post a Comment