I have this PHP script here that turns an array into json:
while($row = $result->fetch_row()){
$array[] = $row;
}
echo json_encode($array);
which returns this
[["No","2013-06-08","13:07:00","Toronto","Boston","2013-07-07 17:57:44"]]
Now I trying to display values from this json code into my apps labels. Here is the code from my ViewController.m file:
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
NSString *strURL = [NSString stringWithFormat:@"http://jamessuske.com/isthedomeopen/isthedomeopenGetData.php"];
// to execute php code
NSData *dataURL = [NSData dataWithContentsOfURL:[NSURL URLWithString:strURL]];
// to receive the returend value
/*NSString *strResult = [[[NSString alloc] initWithData:dataURL encoding:NSUTF8StringEncoding]autorelease];*/
self.YesOrNow.text = [NSJSONSerialization JSONObjectWithData:dataURL options:0 error:nil];
}
But my label YesOrNow is not displaying anything :( What am I doing wrong?
Do I need to install a JSON library?
[0] = (Class) <error: unknown Class>NSLog(@"Server Data = %@",[NSJSONSerialization JSONObjectWithData:dataURL options:0 error:nil]);and i am getting the data