我正在尝试将场地保存到NSArray
. NSDictionary
Venue 是Response中的一个数组。我想要一个NSArray
有所有场地的,这样我就可以填满一张桌子。
NSURL *url = [[NSURL alloc] initWithString:@"https://api.foursquare.com/v2/venues/search?ll=40.7,-74&query=dog&limit=10"];
NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url];
AFJSONRequestOperation *operation = [AFJSONRequestOperation JSONRequestOperationWithRequest:request success:^(NSURLRequest *request, NSHTTPURLResponse *response, id JSON) {
NSDictionary *responseData = [JSON objectForKey:@"response"];
self.venues = responseData[@"venues"];
[self.tableView setHidden:NO];
[self.tableView reloadData];
} failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error, id JSON) {
NSLog(@"Request Failed with Error: %@, %@", error, error.userInfo);
}];
[operation start];
四个正方形部分
response: {
venues: [{
id: "4ea2c02193ad755e37150c15"
name: "The Grey Dog"
contact: {
phone: "+12129661060"
formattedPhone: "+1 212-966-1060"
}
location: {
address: "244 Mulberry St"
crossStreet: "btwn Spring & Prince St"
lat: 40.723096
lng: -73.995774
distance: 2595
postalCode: "10012"
city: "New York"
state: "NY"
country: "United States"
cc: "US"
}