将照片上传到Instagram会出错

时间:2020-01-24 20:53:29

标签: c# json instagram-api

使用InstaSharper SDK时,执行简单的照片上传时出现json错误。我可以通过api进行身份验证并收集用户信息。还尝试了几种其他方法来将InstaImage对象上的URI设置为无效。

解析值时遇到意外字符:S.路径”,第0行,位置0。

    public async Task CreatePost()
    {
        try
        {
            var img = new InstaImage()
            {
                URI = new Uri(Path.GetFullPath(@"C:\dev\testimg.jpg"), UriKind.Absolute).LocalPath,
                Height = 1050,
                Width = 700
            };

            // Errors below on postRequest: 
            // Unexpected character encountered while parsing value: S. Path '', line 0, position 0.
            var postRequest = await api.UploadPhotoAsync(img, "testing app");

            if (!postRequest.Succeeded)
                throw new InstagramPostException(postRequest.Info.Message);
        }
        catch (Exception ex)
        {
            throw new InstagramFollowException(ex.Message);
        }
    }

0 个答案:

没有答案