Unity Facebook SDK - Strange FB.Login() Behavior in iOS App - ios

I'm working on connecting an app to Facebook using the Facebook SDK for Unity. The process seems to be working fine except sometimes if a new user tries to use Facebook to login the FB.Login() doesn't ask them for permission to use their birthday and email.
Im using this call for the login:
FB.Login("email, user_birthday", AuthCallback);
and in the Facebook app dashboard, under permissions I added email and user birthday.
What seems to be happening is the first time the user goes to use the Facebook connect and hasn't ok'd the permissions on the login yet when they sign in a dialog pops up in the Facebook webview as them to authorize my app for "friends list and public profile" they hit ok and then my login process fails because I need access to the birthday and email. If they hit my login button again then the FB.Login() function runs again bringing up a second dialog asking for permission to use email and birthday, after they ok this my own login works fine. The other option is to hit the home button on the device reopen the app hit the Facebook connect button again and this time the authorization dialog has all four options "public profile, friends list, email, and birthday"
I followed the docs at https://developers.facebook.com/docs/unity/ for the connect process so I'm not sure where I went wrong.
Any insight into this would be helpful. Just unsure of where to continue looking I have exhausted most of my debugging avenues but I'm new to the Facebook scene, so it's possible i missed something.
Thanks for any help in advance.
EDIT** I'm using Facebook SDK version 4.2.1 and Unity 4.2.0f4

Related

Facebook log in keep redirecting in iOS

I have an Unity application using Facebook SDK for user to link their account. Everything works in Android. But in iOS, the login page keep redirecting to the previous page which asking me to login even I press "Continue".
https://youtu.be/nGs8jiaI24s
I have found that there is a post asking the same question. But the solution does not work for me.
Unity Facebook SDK is keeping on asking me to confirm login every time I login to my game
In my case, FB.IsLoggedIn return false so loginWithReadPermission is still being called and user fall in the loop between login and continue.
Are there any method to solve it, or at least get the error message?

ios - multi facebook account on one device

I'm having an iOS app, need Facebook login to share something to wall. Everything is ok until I received new feedback from customer. Let me describe this case.
Apple have integrated Facebook into iOS system, user just needs to login via Setting, it is so easy for user. But my customer does not want to do that, they want user to login Facebook inside app and use it instead of Facebook of iOS system. Problem is here, there is a case: user has already logged in Facebook account A via iOS system, then user opens app and login Facebook inside app with other Facebook account B. After that, user shares a picture. Requiment is this picture should be shared on wall of Facebook account B (of app), but this picture appeared on wall of Facebook account A(of iOS system).
I just wonder do we have any solutions to resolve this case? Please give me any ideas you all have in mind after reading.
Thanks,
Ryan
I faced the same problem with Facebook SDK whenever a user login from any app using Facebook it change userid returned with the token which leads to share on the latest opened account.
if you open Facebook from a browser you will get this message from Facebook " we got confused please re-login "
so i took the same approach i saved user-id User(A) and whenever user share i check id coming with token if it changed i show " Facebook account changed please relogin " & i log all users out.
check this link may be helpful: https://www.facebook.com/help/community/question/?id=10205949056147843

Conflicting errors when login to IOS app using facebook connect

After installing facebook login, we have 2 developers using their own devices (Both using IOS 6.1.2) with conflicting differences.
Developer 1: Clicks facebook login button, and is redirected to URL to enter facebook login/password- then accept permissions. The process works.
Developer 2: Clicks facebook login button, receives permissions dialog in popop (not by url) and does not ask for facebook login/password. The process crashes every time immediately when click (OK) for permissions.
We have spent a great deal of time on this and would appreciate any help!
It sounds to me like Developer 2 has logged into FB in iOS settings, while Developer 1 has not.
That would explain the difference in the login process, though I can't say why iOS-driven FB login would crash but Safari-driven login would not.

Facebook iOS SDK and Safari based authentication issue

I have used latest FB SKD in my iOS app so users can use facebook account to login. Application open the FB app and comes back to my app perfectly fine. However, in some place in the app, i have to show/pull some people facebook page (safari based using WebView), but even user already used the Facebook account to login into my native ios app, but the page still ask user to login again and when they click login, it shows them the annoying FB username/pass page.
Is there anyway, that the FB safari based page can authenticate the user since it's already logged into my app using FB integration? do i have to include query or something. Please give me details how to solve this problem since i'm new in this..
thanks again for your help...
pic: https://www.dropbox.com/s/rjlptu7ufpcq3vl/fb.png
When the user switches to Facebook app to authenticate, it doesn't create a cookie for your UIWebView which is why it's asking to login again. Have the user authenticate inside the UIWebView without switching to the Facebook app.
What you're talking about also sounds like a similar thing that happens with Facebook dialogs not knowing about the current Facebook session.
If you authenticate your user via Facebook, try saying the Facebook object itself as an instance variable somewhere in memory so you can access it again (a property on a singleton controller, perhaps?).
Spawning dialogs from an authenticated Facebook object appears to let them use the dialog without reauthenticating iff you have a [FBSession activeSession]. So you'd also have to maintain an active FB session. But I'm not sure if this kind of solution will work since you didn't show specific code for how you're doing your web-based FB fetches.
This question might also prove helpful:
Implement Login with Facebook in iOS 5 and 6

can't switch users for FB connect on iOS

I have FB connect implemented in my app. After battling with the FB app installed on a user's phone, I finally had success forcing the standard FB dialog and bypassing the FB app
(see iOS: Connect to Facebook without leaving the app for authorization)
My new problem is that I cannot seem to switch FB users within the app. When I click the "Login with Facebook" button from within my app, it quickly brings up the FB dialog, dissappears, and always logs me back in with the previous user (meaning I have no way to switch FB users).
I've check both Safari and the FB app, and neither are logged in. Do I have to tell FB to log out the previous user before a new user/pass is prompted?
Thanks
Your implementation probably saves user's access token in NSUserDefaults. If it is so - you just need to delete it from NSUserDefaults any time there is a logout or you're switching users.
Also if needed you are able to deauthorize the user by making a DELETE graph API call to uid/permissions.
hope this helps

Resources