Unity Ninja Unity 3D Forum
To have exclusive access to all downloads, recourses and links within this forum, a free registered account is required. Just a heads up Wink

You are not connected. Please login or register

Unity Ninja Unity 3D Forum » HELP » Help (General) » Share an Image on Faceook

Share an Image on Faceook

View previous topic View next topic Go down  Message [Page 1 of 1]

1 Share an Image on Faceook on Sat Apr 15, 2017 12:20 am

SarthakShah7


Member [Lv. 2]
Member [Lv. 2]
Hey guys, I want to share a screen shot to Facebook with other text content (if possible) or without any content. I found 2 way and I tried both of them none seems to be working perfectly.

I am using Facebook SDK for unity v7.2.2 and unity 5.4.2f2.

The 1st way I deed is using FB.Sharelink. Here is a step by step information about it. 1. Take the screenshot

Store to application.persistendatapath

Upload to other own hosted server

File successfully uploaded on server.

Now put the game for manual wait for 10 second for image uploading.

Once image uploaded on server Facebook sharing dialog appears on device. Current stored image is getting displayed on server.

Post it to Facebook. all post content were fine on dialog on device.

Result at end:. When I saw my post on Facebook i saw other no image and other text content was there.

No when I try to post it on second time what i found on Facebook share dialog is "instead of displaying current saved image on device, Facebook dialog shows previous shared image and when I post it to Facebook it shows other images. it didn't showed previous image also. in post it showing the image that was uploaded 2-3 days ago.

The 2nd way is using FB.API call. Here is the step by step information for executing it 1. Here is code for that

byte[] imgData = File.ReadAllBytes (Application.persistentDataPath + "/" + fUserName.Value +
pngExtention);
Texture2D imgtex = new Texture2D (333,333);
imgtex.LoadImage (imgData);
WWWForm wwwForm = new WWWForm ();
wwwForm.AddBinaryData("image",imgData,"temp.png");
FB.API ("me/photos", Facebook.Unity.HttpMethod.POST, ShareCallBack, wwwForm);
When I executed above code I got response back saying "403:Forbidden". It simply means I have authority to use respected website page.

I am using FB.LoginWithReadPermission with following permission :. public_profile, email, user_friends. Do I have to use FB.LoginwithWritePermission with particular permission ?

Please help me on this. Thanks in advance.

View user profile

View previous topic View next topic Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum