我试图使用NSURLSession从谷歌距离api获取数据,但如下所示,当我打印响应和数据时,我得到的结果为NULL.可能是什么问题?或者是否有任何其他更好的方法来获取JSON数据.
NSString *urlAsString = [NSString stringWithFormat:@"https://maps.googleapis.com/maps/api/distancematrix/json?origins=Vancouver+BC|Seattle&destinations=San+Francisco|Victoria+BC&mode=bicycling&language=fr-FR&key=API-KEY"];
NSURL *url = [NSURL URLWithString:urlAsString];
NSURLSession *session = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]];
[[session dataTaskWithURL:[NSURL URLWithString:urlAsString]
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
NSLog(@"RESPONSE: %@",response);
NSLog(@"DATA: %@",data);
}] resume];
Run Code Online (Sandbox Code Playgroud) let cell = tableView.dequeueReusableCellWithIdentifier("cellReuseIdentifier", forIndexPath: indexPath) as! CustomTableViewCell
Run Code Online (Sandbox Code Playgroud)
创建单元格后,我不想重复使用单元格,我希望它在内存中可用.
有没有办法在同一工作空间中实例化另一个项目的情节提要?通过使用不同的故事图板名称并指向其捆绑包。
ios ×3
iphone ×2
ipad ×1
json ×1
nsurlsession ×1
objective-c ×1
swift ×1
swift2 ×1
uitableview ×1