gpt4 book ai didi

java - 这个 VenuesExplore 有什么问题吗?

转载 作者:太空宇宙 更新时间:2023-11-04 15:01:46 24 4
gpt4 key购买 nike

我试图从以下代码中获取 field 名称,但不断出现错误。很明显,该片段存在一些逻辑错误。如何让它显示数据?

字符串callbackUrl = "https://developer.foursquare.com/docs/samples/explore?client_id=6666666&v=20140101&ll=43,-79&client_secret=55555555 ";

FoursquareApi foursquareApi = new FoursquareApi(clientId, client_Secret, callbackUrl);

Result<Recommended> result = foursquareApi.venuesExplore(ll, null, null, null, null,null,query, null, null);
if (result.getMeta().getCode() == 200)
{

for (RecommendationGroup venue : result.getResult().getGroups())
{
for(Recommendation r: venue.getItems())
{
CompactVenue cmp = r.getVenue();
System.out.println(cmp.getName());
}

}
}
else
{
System.out.println("Error occured: ");
System.out.println(" code: " + result.getMeta().getCode());
System.out.println(" type: " + result.getMeta().getErrorType());
System.out.println(" detail: " + result.getMeta().getErrorDetail());
}

程序运行时不显示任何内容。所以我猜这是逻辑错误。

最佳答案

我也有同样的错误。对我来说,它有助于更​​改 FoursquareApi 的venuesExplore() 方法。

public Result<Recommended> venuesExplore(String ll, Double llAcc, Double alt, Double altAcc, Integer radius, String section, String query, Integer limit, String basis) throws FoursquareApiException {..}

好像是关键字的json解析有问题。所以我改变了:

 KeywordGroup keywords = (KeywordGroup) JSONFieldParser.parseEntity(KeywordGroup.class, response.getResponse().getJSONObject("keywords"), this.skipNonExistingFields);

至:

 KeywordGroup keywords = new KeywordGroup(); 

因此结果中没有关键字,但答案的其余部分解析正确。

关于java - 这个 VenuesExplore 有什么问题吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22492305/

24 4 0
文章推荐: java - 使用标准/输出流作为字符串输入/输出
文章推荐: 获取完整函数路径和声明的 C++ 宏
文章推荐: javascript - 为 `