无需其他类库
1: - (IBAction)callapi:(id)sender {
];
3: NSURLRequest *request=[NSURLRequest requestWithURL:url];
4: [NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) {
//json
6: NSDictionary *r=[NSJSONSerialization JSONObjectWithData:data options:0 error:NULL];
int cnt=[r count];
,cnt);
,cnt];
10:
//string
//NSString *str=[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
//NSLog(str);
//[self resultlbl].text=r[0][0];
15: }];
16: }