简体   繁体   English

上传照片并标记朋友Facebook SDK C#

[英]Upload Photo and tag friends Facebook SDK C#

I can upload the photo now and also I can tag a place in the same post. 我现在可以上传照片,也可以在同一帖子中标记地点。 But when I tag some friends I got OAuthException #100 tags parameter must be non-empty . 但是,当我标记一些朋友时,我得到了OAuthException #100 tags parameter must be non-empty What I want is to upload the photo on the timeline with friends tagging on the post not on the photo. 我想要的是在时间轴上上传照片,并在帖子上标记而不是在照片上标记的朋友。

I did a research for a couple of week but no answer for this. 我做了一个星期的研究,但没有答案。 My algorithm is first to upload the photo and then post with the tags, but I have no idea about the API. 我的算法是先上传照片,然后再添加标签,但是我对API一无所知。

Here is my code: 这是我的代码:

var Posting = "/me/photos";
WriteableBitmap wrbitIma = new WriteableBitmap(bitMapImage);
MemoryStream ms = new MemoryStream();
Extensions.SaveJpeg(wrbitIma, ms, bitMapImage.PixelWidth, bitMapImage.PixelHeight, 0, 100);

PostParam = new
{
    message = TxtBox.Text,
    place = FacebookHelper.PlaceID,
    tags = FacebookHelper.array_ofSelFriendsID,
    picture = new FacebookMediaObject { ContentType = "image/jpeg", FileName = DateTime.UtcNow.ToString("ddmmyyyyhhmmss") + "-photo.jpeg" }.SetValue(ms.ToArray()),
    privacy = new { value = stringPrivacy() }
};

_cts = new CancellationTokenSource();
var uploadProgress = new Progress<FacebookUploadProgressChangedEventArgs>();
uploadProgress.ProgressChanged += (o, args) => UploadingProgressBar.Value = args.ProgressPercentage;

dynamic fbPostTaskResult = await facebookClient.PostTaskAsync(Posting, PostParam, null, _cts.Token, uploadProgress);

Plus, why do I see UploadProgress is always full at 100% ? 另外,为什么我看到UploadProgress总是充满100%?

The only thing I can think of that might be causing this is that, if those certain friends who don't tag properly have their settings geared not to allow tags. 我能想到的唯一原因可能是,如果某些未正确标记的朋友的设置被调整为不允许标记。 In that case there's nothing you can do about that, it's all on them. 在这种情况下,您无能为力,全都在他们身上。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM