0
\$\begingroup\$

I don't know what's wrong. I know that FB.Login is already deprecated. I don't know what syntax to use.

public class FBholder : MonoBehaviour {
    void Awake(){
        FB.Init (SetInit, OnHideUnity);
    }

    private void SetInit()
    {
        Debug.Log ("FB Init Done");

        if (FB.IsLoggedIn) {
            Debug.Log ("FB Logged in");
        } else {
            FBlogin ();
        }
    }

    private void OnHideUnity(bool isGameShown)
    {
        if (!isGameShown) {
            Time.timeScale = 0;
        } else {
            Time.timeScale = 1;
        }
    }

    void FBlogin()
    {
        FB.LogInWithPublishPermissions ("user_about_me, user_birthday", AuthCallback);
    }

    void AuthCallback(ILoginResult result)
    {
        if (FB.IsLoggedIn) {
            Debug.Log ("FB Logged in worked");
        } else {
            Debug.Log ("FB Logged in failed");
        }
    }
}

and I'm getting this error

Assets/FBholder.cs(40,6): error CS1502: The best overloaded method match for `Facebook.Unity.FB.LogInWithPublishPermissions(System.Collections.Generic.IEnumerable, Facebook.Unity.FacebookDelegate)' has some invalid arguments

and this

Assets/FBholder.cs(40,35): error CS1503: Argument #1' cannot convertstring' expression to type `System.Collections.Generic.IEnumerable'

\$\endgroup\$
1
\$\begingroup\$

According to this link, function LogInWithPublishPermissions has 2 arguments: IEnumerable permissions , FacebookDelegate callback. That's why your code dont compile.

If you took this code from tutorial, it maybe just outdated. Change according to FB API Documentation.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.