Skip to content
This repository has been archived by the owner on Mar 9, 2024. It is now read-only.

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

Open
lejeanf opened this issue Sep 29, 2022 · 9 comments
Labels

Comments

@lejeanf
Copy link

lejeanf commented Sep 29, 2022

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();
@lejeanf lejeanf added the bug label Sep 29, 2022
@yasirkula
Copy link
Owner

I wouldn't include DateTime in the filename as is because it might contain invalid filename characters but lucky for you, somehow it didn't seem to happen. I'd still recommend testing the code with a simpler filename like "TestImage.png", maybe Facebook sharing fails when filepath contains certain characters.

What happens when you share to Facebook on iOS? The app doesn't freeze, right? Does the image appear in share dialog but after clicking Share, it disappears or does something else happen?

@lejeanf
Copy link
Author

lejeanf commented Sep 29, 2022 via email

@yasirkula
Copy link
Owner

yasirkula commented Sep 29, 2022

Can you also try sharing only an image (no text or url)?

@UmberFunk
Copy link

UmberFunk commented Oct 13, 2022

I have the same problem, but on both, Android and iOS.

On iOS, the same problem that lejeanf described. On Android, nothing is displayed, nor image, nor text. Other apps that I checked work well.

About a couple of weeks ago it was working well on both. Tried from several phones. Older and newer ones too. It worked on the newest iPhones too.

Might be some changes in Facebook?

@yasirkula
Copy link
Owner

Yeah that's my assumption as well. Can you try sharing content from Gallery, Notes, SMS, etc. apps to Facebook and see what happens?

@UmberFunk
Copy link

Good idea. Seems like a Facebook bug.

I get the same problem when sharing from Gallery and Notes.
Share doesn't work even from Instagram. I tried to share an image from Instagram chat and had the same problem.

Websites and Youtube videos are shared normally.

I don't know if it is related, but anyway I want to note it here. On the bottom part of the screen, there is a popping-up message - "Unable to share to Reels. To share this content, create a post." I am creating a post. Not Reel. I get this message when sharing from Youtube too.

@yasirkula
Copy link
Owner

I've seen someone else encountering the same message and I'm hoping this isn't NativeShare related (the fact that YouTube also has this issue is actually assuring 😏).

@kurisunoob
Copy link

kurisunoob commented Dec 28, 2022

I have the same problem, just facebook does not share the image just the text and link on IOS
I found remove link then image work

@lejeanf
Copy link
Author

lejeanf commented Dec 29, 2022

Has anyone found a solution or workaround?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants