Facebook SDK crashes after Login

Veeru

My code seems to crash on Android with NullPointer exception. But works on ios simulator.

private void CallFBInit()
{
    if(!FB.IsLoggedIn){
        FB.Init(OnInitComplete, OnHideUnity);
    }else{
        shareDialog();
    }
}
private void OnInitComplete()
{
    FB.Login("email,publish_actions",fbLoginCallBack);
}
private void fbLoginCallBack(FBResult result){
    shareDialog();  
}
   #region FB.Feed() example   
    public bool IncludeFeedProperties = false;
    private Dictionary<string, string[]> FeedProperties = new Dictionary<string, string[]>();
    private void CallFBFeed(FBResult result)
    {       
        shareDialog();

    }
    private void shareDialog(){
        Dictionary<string, string[]> feedProperties = null;
        if (IncludeFeedProperties)
        {
            feedProperties = FeedProperties;
        }
        FB.Feed(
            toId: FB.UserId,
            link: ConfigCS.FeedLink,
            linkName: ConfigCS.FeedLinkName,
            linkCaption: ConfigCS.FeedLinkCaption,
            linkDescription: ConfigCS.FeedLinkDescription,
            picture:ConfigCS.FeedPicture,
            mediaSource: ConfigCS.FeedMediaSource,
            actionName: ConfigCS.FeedActionName,
            actionLink: ConfigCS.FeedActionLink,
            reference: ConfigCS.FeedReference,
            properties: feedProperties,
            callback: CallbackForFeed
        );              
    }
    #endregion  
    void CallbackForFeed(FBResult result)
    {       
        if(result.Error!=null){
            errorMessage=ConfigCS.fbError+result.Text;
            showError=true;
            return;
        }else{
            Debug.Log ("FB Feed error");
    }
        return;
    }   
    private void OnHideUnity(bool isGameShown)
    {
        Debug.Log("Is game showing? " + isGameShown);
    }
    #endregion 

I coul'dnt figure out why. When the login dialog is shown, and returns to the app, the app crashes. But if i try again, (since the user is considered logged in), it works without a hiccup. Can somebody see any error in my code?

edit: To be more precise 1. when user clicks share, fb login dialog opens 2. Once the user successfully logs in, and returns the app, the app crashes with nullpointer exception

  1. I open the app again, and click share (at this point the user is already logged in before the crash) and it works.

I coul'dnt pin point the error since adb log just says NullPointException in facebook.loginActivity. My initiating function is CallFBInit();

enter image description here

Edit: One more thing i have noticed is, i have installed facebook sdk 4.3.3 but it shows 4.2.5 in the console enter image description here

and in the editor enter image description here

Veeru

This seems to be a problem with the new 4.3.3 SDK I have downgraded to 4.2.4 and it works fine.

Is this a known problem?

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related