1

我正在使用InstaSharp尝试获取用户的最新媒体帖子。我收到错误:

{"Exception has been thrown by the target of an invocation."}

这是我的代码:

    public async Task<string> GetUserRecentMedia(string userId)
    {
        string response = string.Empty;
        try
        {
            InstagramConfig config = new InstagramConfig(ClientId, ClientSecret, RedirectUri, string.Empty);
            Users usersEndpoints = new Users(config);
            response = ConvertToJson(usersEndpoints.Recent(userId));
        }
        catch (Exception ex) { }
        return response;
    }
4

1 回答 1

0

您需要在异步方法中调用 InstaSharp 方法(正如您所做的那样)并等待您要调用的方法

await usersEndpoints.Recent(userId);
于 2016-01-29T09:37:41.853 回答