简体   繁体   中英

“Login cancelled by player” callback in facebook api for Unity IOS (only if you have facebook app in device)

I am using unity facebook api 4.3.6 for ios. Its working perfectly fine if I don't have #facebookapp in my device. Once I download it and try login, it takes me to #facebookapp and redirect again to my game with callback

FB Login callback : {"is_logged_in":false, "user_id":"", "access_token":""} Login cancelled by player

This happens only if I have facebook app downloaded! I think its some how cache issue but not sure exactly what is it. Any luck?

I believe this is not connected with Unity. Here is few reasons I faced

  1. You need to ask read and write permissions separately. Wait until you get read permissions than send request for write permission.

  2. Make sure your app is allowed to login ( if you have FB app installed on your device )

  3. Make sure you have your app bundle identifier added to developer.facebook.com

Here is what helped me fixed that problem with Unity Facebook-Android.

setting the sandbox mode ON:

  1. Go to https://developers.facebook.com/apps
  2. Select the respective app from the drop down.
  3. Go to 'Status & Review' from the table in the left side of the page.
  4. Do you want to make this app and all its live features available to the general public? - Select switch to set YES/NO value.

if the ON/OFF button is disable, please go back to Settings and enter a valid email address.

I understood why when the device is installed a facebook app, my app can't login facebook.

  • First : software OpenSSL create keyhass wrong. I have downloaded OpenSSL from here : http://code.google.com/p/openssl-for-windows/downloads/list , and it creates keyhash wrong. I have used other OpenSSL sofware, you can download it here : https://www.dropbox.com/sh/t6tt44dc2nm6vza/6mp1W74GiZ , it is create keshash right.

  • Second: In class FacebookAndroidUtil.cs , line 62, you add System.Environment.GetEnvironmentVariable("HOMEDRIVE") before System.Environment.GetEnvironmentVariable("HOMEPATH"). Facebook SDK requires a file debug.keystore in : C:\\Users\\UserName.android\\debug.keystore. If the Unity Editor, Edit Setting Facebook has yet to create android debug hash key. Then use the Eclipse Software, create and run onr any project. Eclipse will generate a debug.keystore. If it is't create in folfer : C:\\Users\\UserName.android\\debug.keystore , then find it, coppy and paste into C:\\Users\\UserName.android\\debug.keystore

  • Third: publish your app in Facebook, so be sure it is:"This app is public and available to all users".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM