gpt4 book ai didi

ios - Foursquare 2 field 中的空 json 响应探索 ios api

转载 作者:行者123 更新时间:2023-11-29 02:43:29 25 4
gpt4 key购买 nike

我正在使用 foursquare iOS api 开发 iOS 应用程序,我想获得推荐的附近 field 。我使用了以下代码,它给了我一个空的结果。我在哪里做错了? ? ?

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);
}

最佳答案

你不能在 NSNumber 和 NSString 中传递 Nil。

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);
}

}];

它对我有用。

关于ios - Foursquare 2 field 中的空 json 响应探索 ios api,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25439226/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com