我正在使用foursquare iOS api开发iOS应用程序,我希望得到推荐的近场地。我使用了以下代码&它给了我一个空洞的结果..我在哪里做错了? ? ?
NSArray* venues;
//get the foursquare locations
- (void)getTipsForLocation:(CLLocation *)location {
//NSLog(@"lat %f",location.coordinate.latitude);
[Foursquare2 venueExploreRecommendedNearByLatitude:@(location.coordinate.latitude)
longitude:@(location.coordinate.longitude)
near:nil
accuracyLL:nil
altitude:nil
accuracyAlt:nil
query:nil
limit:nil
offset:nil
radius:@(1500)
section:nil
novelty:nil
sortByDistance:1
openNow:0
venuePhotos:0
price:nil
callback:^(BOOL success, id result){
if (success) {
NSDictionary *dic = result;
venues = [dic valueForKeyPath:@"response.venues"];
FSConverter *converter = [[FSConverter alloc]init];
self.nearbyVenues = [converter convertToObjects:venues];
//NSLog(@"venues %@",venues);
//NSLog(@"near by places %@",self.nearbyVenues);
}
else{
NSLog(@" foursquare connecting error");
}
}];
NSLog(@"recommended place array %@",venues);
}
答案 0 :(得分:1)
你无法通过Nil,在NSNumber&的NSString。
NSNumber *emptynumber=[[NSNumber alloc] init];
[Foursquare2 venueExploreRecommendedNearByLatitude:lan longitude:lon near:@"" accuracyLL:emptynumber altitude:emptynumber accuracyAlt:emptynumber query:@"" limit:emptynumber offset:emptynumber radius:@(1500) section:@"" novelty:@"" sortByDistance:YES openNow:YES venuePhotos:YES price:@"" callback:^(BOOL success, id result) {
if (success) {
NSLog(@"secondResult: %@",result);
NSDictionary *dic = result;
NSArray *venues = [dic valueForKeyPath:@"response.venues"];
FSConverter *converter = [[FSConverter alloc] init];
self.venues = [converter convertToObjects:venues];
[self.tableView reloadData];
NSLog(@"Data: %@",venues);
}
}];
对我有用。