Why Facebook profile picture request return null on iOS?

225 views Asked by At

Everything works perfect on android but when I try to get the profile picture on iOS devices. The image returns null. I checked the Facebook documentation for iOS 9 I have exactly the same plist as shown in documentation. When I run the app in console I see "FB is log in" message but the profile pic has not shown. Can anyone help?

void Awake()
{
    instance = this;
    FB.Init(SetInıt, OnHideUnity);
}


public void FbLogin() 
{
    // This is an event trigger when the button pressed.    
    List<string> permissions = new List<string>();
    permissions.Add("public_profile");
    FB.LogInWithReadPermissions(permissions, AuthcallBack);
}
void DealWithFbMenus(bool isLoggedIn)
{
    // This function is called in SetInit func in Awake.
    if(isLoggedIn)
    {
        fbButton.SetActive(false);
        profilePicture.gameObject.SetActive(true);
        loggedInPlayer = true;
        //FB.API("/me?fields=first_name", HttpMethod.GET, DisplayUserName);

        FB.API("/me/picture?type=square&height=128&width=128", HttpMethod.GET, DisplayProfilePic);
    }
    else
        fbButton.SetActive(true);
}

void DisplayProfilePic(IGraphResult result)
{
    if(result.Texture != null)
    {

        profilePicture.sprite = Sprite.Create(result.Texture, new Rect(0,0, 128, 128), new Vector2());

    }

}
1

There are 1 answers

0
Çağatay Kaya On

It is a bug on Unity 5.2. It fixed on new version of Unity 5.3