一切都在Unity编辑器中完美运行,但是当我为iOS构建并在设备上测试时,每当我尝试登录facebook时都会出现此错误:
由于未捕获的异常终止应用程序' NSInternalInconsistencyException',原因:'无法在迭代过程中开始迭代'
这是我在Unity中的代码:
public Button fbLoginBtn;
public void FbLogin()
{
var perms = new List<string>(){"public_profile", "email", "user_friends"};
FB.LogInWithReadPermissions(perms, AuthCallback);
}
private void AuthCallback (ILoginResult result)
{
if (FB.IsLoggedIn)
{
// AccessToken class will have session details
var aToken = Facebook.Unity.AccessToken.CurrentAccessToken;
// Print current access token's User ID
Debug.Log(aToken.UserId);
// Print current access token's granted permissions
foreach (string perm in aToken.Permissions)
{
Debug.Log(perm);
}
} else {
Debug.Log("User cancelled login");
}
}
我错过了什么吗?
感谢您的帮助!