Putting data from SONObjectWithData to UITableView
Posted
by
user2966615
on Stack Overflow
See other posts from Stack Overflow
or by user2966615
Published on 2014-05-29T09:08:09Z
Indexed on
2014/05/29
9:25 UTC
Read the original article
Hit count: 223
i am building a app in which i am getting data from a php file and already NSLoging it in xcode and it is showing data in this format:
jsonObject=(
(
1,
abc,
"[email protected]",
"501 B3 Town"
),
(
2,
sam,
"[email protected]",
"502 B3 Town"
),
(
3,
jhon,
"[email protected]",
"503 B Town"
)
)
and here is my viewdidload
- (void)viewDidLoad
{
[super viewDidLoad];
statuses=[[NSMutableArray alloc]init];
NSURL *myURL = [NSURL URLWithString:@"http://url/result.php"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:myURL cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:60];
[NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response, NSData *data, NSError *error)
{
NSLog(@"Finished with status code: %i", [(NSHTTPURLResponse *)response statusCode]);
id jsonObject = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments error:nil];
NSLog(@"jsonObject=%@",jsonObject);
statuses = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&error];
}];
}
now i want to display all records in uitableview. can anyone tell me how can i do that. Thanks
© Stack Overflow or respective owner