내 코드는 NullPointer 예외로 인해 Android에서 충돌하는 것 같습니다. 그러나 iOS 시뮬레이터에서 작동합니다.
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
나는 이유를 알 수 없었다. 로그인 대화 상자가 표시되고 앱으로 돌아 가면 앱이 충돌합니다. 그러나 다시 시도하면 (사용자가 로그인 한 것으로 간주되기 때문에) 딸꾹질없이 작동합니다. 누군가 내 코드에서 오류를 볼 수 있습니까?
편집 :보다 정확하게 1. 사용자가 공유를 클릭하면 fb 로그인 대화 상자가 열립니다. 2. 사용자가 성공적으로 로그인하고 앱을 반환하면 앱이 nullpointer 예외와 함께 충돌합니다.
adb 로그에 facebook.loginActivity에서 NullPointException이 표시되므로 오류를 정확히 지적하지 못했습니다. 내 시작 함수는 CallFBInit ();
편집 : 내가 알아 차린 또 하나는 facebook sdk 4.3.3을 설치했지만 콘솔에 4.2.5가 표시된다는 것입니다.
그리고 편집기에서
이것은 4.2.4로 다운 그레이드 한 새로운 4.3.3 SDK의 문제인 것 같고 잘 작동합니다.
이것이 알려진 문제입니까?
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다