Unity and Facebook SDK integration

I ran into an odd problem while integrating my game with Facebook SDK for Unity.

I am using latest Facebook SDK for Unity ( 3.1.2 ) and here is my code in a class I made:

public SocialConnect()
{
	instance = this;
 
	if ( ! IsInitCalled )
	{
		IsInitCalled = true;
			
		FB.Init ( DoNothing , OnHideUnity );
	}
}
	
	
public void Login()
{	
	if ( ! FB.IsLoggedIn )
	{
		FB.Login ("publish_actions", OnLogin );
	}
}
	
private void DoNothing()
{
}
	
private void OnInitComplete()
{
    IsInit = true;
		
	if ( PlayerPrefs.GetInt("installed" , 0 ) == 0 )
	{
		PlayerPrefs.SetInt("installed" , 1 );
		PlayerPrefs.Save();
		
		FB.PublishInstall();
	}
}
	
private void OnLogin()
{
}
	
private void OnHideUnity(bool isGameShown)
{
        Debug.Log("Is game showing? " + isGameShown);
}

private void Callback( string response )
{
	Debug.Log ("Facebook callback: " + response );
}
public static SocialConnect getInstance()
{
	if ( instance == null )
	{
		instance = new SocialConnect();
	}
		
	return instance;
}

I call these methods from another scripts, for example:

if ( FB.IsLoggedIn )

	// Display leaderboards here	
}
else
{
	 SocialConnect.getInstance().Login();
}

After releasing the update, I am getting following issues:

1- When I run FB.login method, after clicking OK on the confirmation page on Facebook, it doesn’t grant me publish_actions permission so when FB.isloggedin varable will stay false and my app keep asking to Login again.

2- I got 2 different crashes in the last 24 hours with following for many users with following errors:

A.
Caused by: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=64206, result=0, data=null} to activity {com.facebook.unity.FBUnityPlayerActivity}:

B.
Caused by: java.lang.RuntimeException: Unable to resume activity {com.facebook.unity.FBUnityPlayerActivity}: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=64206, result=0, data=null} to activity

Thank you for your suggestions and help.

I also got same problem with below error:

09-13 11:05:31.703: E/AndroidRuntime(25331): FATAL EXCEPTION: main
09-13 11:05:31.703: E/AndroidRuntime(25331): java.lang.Error: FATAL EXCEPTION [main]
09-13 11:05:31.703: E/AndroidRuntime(25331): Unity version : 4.1.5f1
09-13 11:05:31.703: E/AndroidRuntime(25331): Device model : asus Nexus 7
09-13 11:05:31.703: E/AndroidRuntime(25331): Device fingerprint: google/nakasi/grouper:4.2.2/JDQ39/573038:user/release-keys
09-13 11:05:31.703: E/AndroidRuntime(25331): Caused by: java.lang.RuntimeException: Unable to resume activity {com.Progmind.T2VonUnity/com.facebook.LoginActivity}: java.lang.NullPointerException

This problem only occurs, if the user has installed a native facebook app. Facebook login dialogue checks of the user has installed the app or not.

if the app is installed,it will open the inApp login dialogue.(problem occurs, app is not returning user id and access token)

if the app is not installed, it will fetch the login dialogue from the web,user can login.(works perfectly, returns userID and Access Token).

I have this problem,when the native app is installed.otherwise works fine.