xamarin / Xamarin.Social

Xamarin.Social
Apache License 2.0
124 stars 74 forks source link

Image Share Issue: "One of the identified items was in an invalid format." #48

Open lobbo232 opened 5 years ago

lobbo232 commented 5 years ago

When sharing to Facebook using the FacebookService i get the following error appear when clicking the "Send" button on the share screen

"One of the identified items was in an invalid format."

I have identified the item with the invalid format to be the image I am including, as the share works perfectly if I do not include an image.

Any help is appreciated as I'm probably doing something wrong.

// image data is a byte[] of a .jpg image from CrossMedia plugin

var images = new List<ImageData>();
images.Add(new ImageData(new MemoryStream(imageData), "image/jpeg"));
// Also tried:
//images.Add(new ImageData(File.OpenRead(photo.Path), null));

var item = new Item
{
    Text = "Test",
    Images = images
};

DependencyService.Get<IFacebookFunctions>().PostToFacebook(item);
wiliam-toney commented 5 years ago

👍👍👍