问题
I am testing Unity 4.3 with Unity Facebook SDK 4.3.4 and have everything running but it seems to always return a Test User and not my actual Facebook Login.
Using the Facebook InteractiveConsole Scene, after Logging in I see:
Facebook Dll: Loaded Successfully
UserId: 0
IsLoggedIn: True
AccessToken: abcdefghijklmnopqrstuvwxyz
Running FriendSmash...Same thing just returns the UserID: 0 and No Name
How do I tell the SDK to actually log ME in and not just a test user?
I can't seem to find anything, I tried setting the App to Not in Sandbox mode
I think I am probably missing something obvious.
Any help?
回答1:
You can't actually log in and get real data in the editor yet. We just return some placeholder data, this is what you are seeing. This is a feature we are currently working on. But for now you will need to run on the iOS simulator, an iOS device, an Android device, or put your game onto Facebook canvas to get a working login.
回答2:
I was trying to run the game from the Editor and the Editor does not actually log you in. It just defaults to USERID:0 and Access Token: abcdefghijklmnopqrstuvwxyz
I compiled the InteractiveConsole Scene to the android device and it gave me the proper login. Check my friendslist and all was good.
Still haven't checked out why FriendSmash doesn't read my name but that's another issue.
Thanks Brian!
回答3:
Alternatively, you can create a script that contains an access token variable that you set by hand. Get the access token from the Facebook Graph API explorer, put it into this variable and pass it into your FB calls. This allows you to log into Facebook when running in the Unity editor.
来源:https://stackoverflow.com/questions/20152140/unity-facebook-sdk-login-always-returns-user-0-access-token-abc-z