Skip to content
This repository was archived by the owner on May 10, 2026. It is now read-only.
This repository was archived by the owner on May 10, 2026. It is now read-only.

Sharing Image to Facebook (iOS) does not share the image just the text and link #151

Description

@lejeanf

The image is created and stored on the device. That part is no problem.
Sharing to other social media like instagram works fine.
Sharing to Facebook under Android works find.
Sharing to Facebook under iOS does not work.

here is the code related to the sharing part:

string imageName = $"IHaveBeenThere_{(int)rect.width}x{(int)rect.height}_{System.DateTime.Now}.png";
		string filePath = Path.Combine(Application.temporaryCachePath, imageName);
		File.WriteAllBytes(filePath, screenShot.EncodeToPNG());
		
		NativeGallery.Permission permission = NativeGallery.SaveImageToGallery(screenShot, "I Have Been There", imageName, (success, path) => Debug.Log("Media save result: " + success + " " + path));

		// To avoid memory leaks
		Destroy(screenShot);

		new NativeShare().AddFile(filePath)
			.SetTitle("I Have Been There")
			.SetSubject(gameName).SetText(shareMessage).SetUrl("https://chunhuacatherinedong.com/")
			.SetCallback((result, shareTarget) => Debug.Log("Share result: " + result + ", selected app: " + shareTarget))
			.Share();

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions