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
4

1 回答 1

1

您需要设置所有参数。不是 null 而是带有空字符串和空字符串的数组。我的例子:

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

response = vkApi.getProfiles(u, d, "", "", "", "");
于 2014-10-21T10:09:43.083 回答