I am new in ios development, I want to add some object from database which I managed to put into a NSMutabledictionary and I want to put into a NSMutableArray to display in a UITableView. Below is my .m file code:
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
jsonURL = [NSURL URLWithString:@"http://localhost:8888/read_product_list.php"];
//jsonData = [[NSString alloc] initWithContentsOfURL:jsonURL];
NSData *data = [NSData dataWithContentsOfURL:jsonURL];
[self getData:data];
}
-(void) getData:(NSData *) response {
NSError *error;
NSMutableDictionary *json = [NSJSONSerialization JSONObjectWithData:response options:kNilOptions error:&error];
//NSLog(@"%@", json);
jsonArray = [[NSMutableArray alloc] init];
/*for(int i = 0; i < json.count; i++){
[jsonArray addObject:[json objectForKey:];
}*/
//NSLog(@"%@", jsonArray);
}
Thank you in advance!