尝试获取用户配置文件信息时出现错误:需要验证码(VK Android SDK)

3

我使用VK Android SDK (com.perm.kate.api) https://bitbucket.org/ruX/android-vk-sdk/overview

我提供的代码最后一行有一天开始返回KException。

根据文档: 如果某种操作频繁完成,则对API的请求可能会返回错误“需要验证码”。用户需要输入图片中的代码,并在请求参数中再次发送带有输入的验证码代码的请求:

  • captcha_sid - 验证码标识符captcha_img
  • 链接到应向用户显示以便他们输入图像文本的图像。

问题是我应该在哪里输入这些参数? 我使用获取用户配置文件的方法,该方法不包含这些参数:

public ArrayList<User> getProfiles(Collection<Long> uids, Collection<String> domains, String fields, String name_case) throws MalformedURLException, IOException, JSONException, KException

获取用户个人资料的代码:
Api vkApi=new Api(account.access_token, Constants.API_ID);
//get user
Collection<Long>userIds=new ArrayList<Long>();
userIds.add(account.user_id);
ArrayList<User> users=vkApi.getProfiles(userIds, null, null, null); //KException
1个回答

1

您需要设置所有参数。不为空,但是是包含空字符串和空数组的数组。以下是我的示例:

Collection<Long> u = new ArrayList<Long>();
u.add(user_id);
Collection<String> d = new ArrayList<String>();
d.add("");

response = vkApi.getProfiles(u, d, "", "", "", "");

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接