[ad_1]
Objective: Utilizing an iOS native technique, push a consumer made image onto their Instagram feed in C#.
public bool ShareImage(byte[] imageByte)
{
bool outcome = false;
//string fileName = "xxx.png";
//string path = Path.Mix(FileSystem.CacheDirectory, fileName);
//File.WriteAllBytes(path, imageByte);
NSData information = NSData.FromArray(imageByte);
UIImage picture = UIImage.LoadFromData(information);
//NSUrl url = NSUrl.FromString($"instagram://library?AssetPath={path}"); // Solely opens
NSUrl url = NSUrl.FromString($"instagram://library?LocalIdentifier={1}");
if (UIApplication.SharedApplication.CanOpenUrl(url))
{
UIApplication.SharedApplication.OpenUrl(url);
}
return outcome;
}
So far as I am conscious the way in which I’ve to do that is to avoid wasting my picture to the machine and get a Native Identifier for this.
I’ve constructed this from the snippets of objective-c code I’ve seen. Sharing images solely works with the native app put in, as I’ve learnt from my trials to get the fb module working.
[ad_2]
