更改Instagram个人资料图像

时间:2020-01-01 22:34:56

标签: c# api instagram sharp

我使用以下代码更改Instagram个人资料的图片,但出现以下错误。

错误是:

Unexpected character encountered while parsing value: S. Path '', line 0, position 0.

有人在这里帮助我吗? 谢谢。 我也为此使用InstagramApiSharp

OpenFileDialog op = new OpenFileDialog();
if (op.ShowDialog() == DialogResult.OK)
{
  byte[] picByte = System.IO.File.ReadAllBytes(op.FileName);
  var result = await 
  ctx.api.AccountProcessor.ChangeProfilePictureAsync(picByte);
  if (result.Succeeded)
  {
    pic_box.ImageLocation = op.FileName;
  }
}

我使用以下代码,但是图像不会再次更改,并且没有错误消息也没有结果

var picturePath = @"C:\Users\Rayehe\Desktop\had.jpg";
var pictureBytes = File.ReadAllBytes(picturePath);
var result = await ctx.api.AccountProcessor.ChangeProfilePictureAsync(pictureBytes);
if (result.Succeeded)
{
MessageBox.Show("New profile picture: " + result.Value.ProfilePicUrl);
}
else
{
MessageBox.Show("Error while changing profile picture: " + result.Info.Message);
}

0 个答案:

没有答案