Cannot Get Facebook Profile Picture Using www in Unity Facebook SDK
I'm trying to get profile picture from graph.facebook.com using Facebook SDK for Unity 7.3.0. My Unity version is 5.3.
This is my function,
public static IEnumerator GetFBProfilePicture (){
WWW url = new WWW (System.Uri.EscapeUriString("https://graph.facebook.com/" + someUserID + "/picture?type=large"));
yield return url;
Debug.Log("Completed.");
Texture2D texture = new Texture2D (180, 180, TextureFormat.DXT1, false);
url.LoadImageIntoTexture (texture);
// ...
}
and I call this function like
StartCoroutine (GetFBProfilePicture ());
It works fine in Unity Player and also in Android devices. But in iOS devices, "Completed." line doesn't show up. And there is no error log. It just keep waiting in the url line.
I tried it with iOS 7 and 9 with wireless connection and mobile data. Problem still occurs.
We have finally fixed this, essentially we purchased the Best Http Pro plugin (and disabled all the other features at compile time so we don't increase the executable size too much), now everything works a charm. $$anonymous$$y bet is that the www class has some SSL or security issue with Facebook, probably to do with this
Answer by sdpgames · Jan 21, 2016 at 12:09 PM
+1 Same here, we've tried with waiting for isDone and implemented a timeout mechanism, now it times out every time but we're never getting any image. Unity is 5.3.1p3. Does the same on iOS 8, 9, 3G and Wifi equally. Same with https requests too.
Answer by Dudicus · Jan 21, 2016 at 01:19 PM
I don't use Facebook programming but maybe it's because the variable is "WWW url" and your returning and loading "url"?
The LoadImageInfoTexture method is provided by the WWW class itself, somehow abstracting the types of result we can get from a WWW. Anyway in our case (code almost identical to onuraydinay's), it works on all platforms (Editor, PC standalone, $$anonymous$$acOSX); except on iOS + IL2CPP
Answer by yathishgk · Jan 27, 2016 at 12:17 PM
Experiencing the same issue even in Unity 5.3.3f1, The WWW class request for the link http://graph.facebook.com/fb_id/picture?height=160 never gives response. The same has been conveyed to FB and we received the response that they have not changed anything. Was working fine 5.3.1f1. Works fine for Android and Editor even in Unity 5.3.3f1.But in iOS Unity 5.3.3f1 no response.
Answer by AmrmHady · Nov 12, 2017 at 02:29 PM
have u tried putting the access_token? u have to put it if u use www url. just try. "......./?access_token="+AccessToken.CurrentAccessToken
Your answer
Follow this Question
Related Questions
wait WWW to finish download with yield does not work 0 Answers
WebGL/WebSocket has stopped while processing WWW.LoadFromCacheOrDownload 0 Answers
Loading array of objects by using parent folder name in asset bundle? 0 Answers
Streaming video as MovieTexture 2 Answers
Writing Files to Android Device 0 Answers