facebook-unity-sdk not working on iOS (facebook-unity-sdk) - facebook

I am using Unity Facebook SDK 5.1 and Unity version is 4.3.0.
I am testing on iPhone 4 device which don't have facebook app installed.
I have integrated SDK inside my game.
When i try to login into facebook using my app first it opens the FB login page inside browser,after login it ask me for authorization when i press "Ok" it takes me to my app.
Inside LoginCallBack method i got the following response
FBResult.Text =
{"is_logged_in":false,"user_id":"","access_token":"NOT_USED_ON_IOS_FACEBOOK","access_token_expires_at":"01/01/0001 00:00:00"} .
Many Thanks
Sachet

Make sure that your URLSchemeSuffix in your Info.plist is correct (fb[appid]) and that the handleOpenURL call (in your generated XCode project) is making it back to facebook.
I had the very same problem where another plugin was capturing the handleOpenURL call when i was returning from facebook after authorizing the app and it was preventing the handleOpenURL response from making it all the way back to the facebook plugin.
You can test it by putting a breakpoint in the Facebook/FbUnityInterface.mm file #
- (BOOL)openURL:(NSURL*)url sourceApplication:(NSString*)sourceApplication
If this isn't being hit, it's likely another openURL handler is getting the response first and not handing it back to super.

I got the same error but for different reasons using iOS native login.
I checked the URLScheme, add some breakpoints in the different OpenUrl but got nothing. Turns out I was logging with the "publish_actions" permissions. The message meant that this was not supported by iOS native implementation I suppose.
I regret the message not being helpful but you should pay attention to the requested permissions at login and ask them later using the graph API.
Hope that will help people having the same issue.

I got the same error. Reason was in incorrect bundle id (we used different bundle ids for release and development builds). Then we added this bundle id to Facebook App's Settings page, and the error gone.

Related

Facebook Login Error iOS Application

My iOS application allows me to login using my own facebook account successfully. But when I send it on test flight to a friend, the app downloads but when he presses connect to Facebook (which works on my simulator and personal device), it won't let him log in. Doesn't even give him the option to, just spits out an error (com.facebook.sdk error 2). What am I missing? What would cause it to work for me, but not for others? I'm just looking for a general answer here because I followed all the facebook tutorials and I can't imagine what kind of thing could be going wrong.
I just figured out the problem. Should have been SUPER obvious, but being new to development I didn't realize I needed to change the sandbox setting to disabled in order to allow others to access facebook through my app.
This error pops up when your app is not authenticated properly.
You need to keep your BundleId the same at all places.
Change your bundleId in the app that you have registered on Facebook as com.asdad.casd instead of < teamId >.com.asdad.casd

iOS app misconfigured for Facebook integration

I am using the facebook-iphone-sdk framework to integrate my iPhone app to FB. The problem is when I click the button it gives an error "The application you are using is misconfigured for the Facebook integration. Please download the latest version of the app."
I was able to connect with FB only once. For the first time it worked fine and I was also able to post some data into my wall but afterwords it not working, and the above error occurs.
What could I be doing wrong?
The Bundle ID is case sensitive so watch out for that.
e.g. com.myapp.MyApp is not the same as com.myapp.myapp
This happened to me and gave the same error message.
May be you are using the deprecated API of facebook... Please use the New FBGraph API for facebook integration ....
How to share or post by mail, twitter and facebook from the current application?
This is not only about email... here you will find the tutorial and sample code for facebook integration.....!!
Possible Solutions:
1) Double Check that you are putting in the right facebook app id in your code, and that you didnt somehow overwrite that when you made it work the first time.
2) Check that in the facebook developer profile you have all the proper things set up (They have decent doc's for how to set up properly).
3) Check that you are using the most up to date version of the SDK for fb.
4) Consider using the built-in Facebook for iOS6, since you probably wont be releasing your app before iOS 6 comes out anyways.
5) If all else fails, start over and go through the instructions from beginning to end. Check and re-check everything you set up and carefully scan for little typos or something. It's probably a minor mistake somewhere that you're overlooking.
6) Post code if you want more specific help. An error message isnt enough to deduce what your problem is.
Just delete you app from facebook dashboard, create it again, and then change the facebookID in you App-Info.plist, in the key FacebookAppId and URL types array key. I did it and my app works fine.
Delete facebook app, force perform login in safari..

SSO login dialog returns to fbDidNotLogin with no indication of error

I have recently created a new Facebook app ID as I'm adding Facebook SSO integration into my app. My app within Facebook is set to Native iOS and I've included the Bundle ID and a current published app's Apple ID (for testing).
I've implemented the SDK as per the instructions (I have two other iOS apps currently using the SDK without issue as well). All delegate methods and required plist entries are in place for the URL callbacks.
After attempting a login I'm shown the Facebook white screen (just a loading spinner) with blue bar but after 5 seconds it redirects back to my app and hits the fbDidNotLogin delegate method. That method doesn't include any sort of retrievable error (at least none that is documented or available to me).
So at this point I'm at a loss for what might be causing my login to fail. Is there any way to get a more detailed error? Or has anybody else run into this same problem?
I had the same issue. Solved this by changing two items in the Facebook app settings:
Configured for iOS SSO set to enabled
Updated the iOS Bundle ID so that it matched by bundle ID exactly (previously the casing was different)
Not sure which item fixed it, I largely suspect the first...but worth checking both.
Make sure your device's time and date settings are correct. I had this happen to me when I recharged and turned on an iPod whose battery had died. The date and time were totally wrong, and when I set them to what they were supposed to be, I got the Facebook login dialog just fine.

Facebook Connect Open native facebook App,

I have an iPhone app using facebook connection using FBConnect from github code.
It worked fine in the simulator, however when I installed it in the device with existing facebook app from facebook it didn't work. It opens the existing facebook app instead of returning to my own app.
Checkout this link.
Better you can go with the approach given in the link as it works fine. I have myself tried this code and it has worked for me.
Also the sample project (with Facebook API implemented in it) is given in the below link which will be helpful for you to while implementing the facebook API as per the method given in the below link.
http://www.raywenderlich.com/1488/how-to-use-facebooks-new-graph-api-from-your-iphone-app
Also you can test the sample project on your device before going for this approach
Hope this helps you.
EDIT:
Have you registered a URL handler to respond to return requests from the Facebook app? on iOS 4 the Facebook SDK uses fast app switching which is designed to let the app handle most of the heavy lifting and let the users just hit "Accept" instead of having to re-enter login/passwords

Facebook authentication with new 'Facebook SDK for iOS' vs. old 'Facebook iPhone SDK'

I'm working on integrating Facebook with my iPhone/iOS application and I want to know if I'm understanding the nature of the login procedure correctly.
With the old Facebook SDK ('Facebook iPhone SDK'), when we needed to request authentication permission from a user a UIWebView would be displayed with a login prompt. With the new SDK ('Facebook SDK for iOS'), the SDK uses Apple's fast-app-switching feature to temporarily place the app in background mode and then load the iOS Facebook app or Safari to authenticate. Is this basically the gist of it?
I've experimented with authenticating my app via the new SDK's technique and due to the nature of my app, it just can't support backgrounding. Does this mean I have to use the old SDK to launch a UIWebView-based authentication? I think this implementation is a lot cleaner anyway. Will I run into any major disadvantages from doing this?
Check out this question and my answer: Iphone facebook connect example calls safari. I don't want to use safari
You can make it use the UIWebView always. Facebook is trying to make it so the user only has to log in once per device (through either the Facebook app or in Safari) but I didn't like this flow (especially on the iPad). Though I'd rather not muck around with the Facebook code, I did find commenting out a few lines to be a quick way of getting the old behavior back.
I don't believe this is the case.
The Facebook SDK that I'm aware of, available at https://github.com/facebook/facebook-ios-sdk doesn't do anything like you describe. Is this the SDK you're using? I believe the last major update to this SDK from the "old" facebook SDK was to add support for OAuth-style authentication. With this change they broke code compatibility so apps were forced to make changes to incorporate the latest SDK.
When you call 'authorize' in this SDK you pass the app id, the desired permissions, and a callback delegate for notifications of errors or success (did login, did not login, did logout). You can also set any access token that you might have persisted from a previous session. Facebook validates this access token, and if it doesn't exist or is invalid it presents a modal login dialog. I believe the content of this dialog is a web page. The SDK authenticates the user using OAuth and makes the auth-token available for persisting between sessions.
At no time is the app exited to run the Facebook app or Safari. I'm curious - what led you to believe this was the case? (Or, perhaps there is some other SDK out there I'm unaware of?)
Take a look on this page: https://github.com/facebook/facebook-ios-sdk
And look at Single Sign-On. That describes the above scenario with fast switching.