Xcode add mutable dictionary from JSON to mutable array -
i have mutable array stories i'm trying add copy of json response yields o stories , nothing in array. doing wrong? json object formatted , can display each component individually not add array.
nsstring *str=@"http://www.foo.com/some.php"; nsurl *url=[nsurl urlwithstring:str]; nsdata *data=[nsdata datawithcontentsofurl:url]; nserror *error=nil; nsmutabledictionary *response=[nsjsonserialization jsonobjectwithdata:data options: nsjsonreadingmutablecontainers error:&error]; nslog(@"your json object: %@", response); nslog(@"location: %@", response[@"location"]); nslog(@"service id: %@", response[@"serviceid"]); nslog(@"problem: %@", response[@"problem"]); [stories addobject:[response copy] ]; nslog(@"workorders: %d", [stories count]); nslog(@"wo defined: %@",stories);
there go...try
nsmutablearray *stories = [nsmutablearray array];
Comments
Post a Comment