iOS phonegap-plugin-facebook-connect vs Facebook iOS Application - ios

I've been trying to make phonegap-plugin-facebook-connect cordova plugin Simple example work, and i've experienced a weired problem.
First I had the Facebook iOS application on my iphone:
On my test application based on the Simple example, when i click the Login button, it just switches to the Facebook iOS app, and switches back to my application.
Clicking the "Me" button gives me an error "an active access token must be used to query information about the current user" which means the login was not successful
Then I removed the Facebook iOS application from my iPhone:
It worked. It opens Safari with Facebook authorisation page, when i click OK it switches back to my application and the auth.login events are successfully fired.
Is this a known issue ? Is there a way to fix it ?
Thank you

I found a workaround:
in Facebook.m
- (void)authorize:(NSArray *)permissions {
self.permissions = permissions;
[self authorizeWithFBAppAuth: NO safariAuth:YES]; //Use Safari Auth instead of FB App
}
With this workaround Facebook iOS authorization will not be used, wheter installed or not.
Github issue#25

Related

iOS Facebook Account kit - Persist user token when app is opened 2nd time after successful login

My doubt is after successful login using Facebook account kit for the first time, I am reopening the app for the 2nd time. When I open how can I detect and use the existing user Access Token?
I tried by fetching Accountkit.currentAccessToken in appdelegate as a condition to show login page or welcome page. But currentAccessToken returns me null.
I have also enabled "Enable Client Access Token Flow" in app settings.
Kindly help to understand if my approach is right.
self.accountKit = AKFAccountKit (responseType: AKFResponseType.accessToken)
if(self.accountKit.currentAccessToken != nil)
{
//SHOW WELCOME PAGE
}else{
//SHOW LOGIN PAGE
}
I am facing the same issue in Android (not in iOS) but I think the problem is same, since in the document says it so.
this is my code for configuring the login using Email (kotlin, use let to change the val).
val configurationBuilder = AccountKitConfiguration.AccountKitConfigurationBuilder(
LoginType.EMAIL,
AccountKitActivity.ResponseType.CODE)
notice that the response type is AccountKitActivity.ResponseType.CODE
In the document says:
If you began the login session with AccountKitActivity.ResponseType.TOKEN, a logout option is available to remove the stored AccessToken from the device.
So the problem is on the Response type that I use, need to be changed into AccountKitActivity.ResponseType.TOKEN in order to make the token stored on devices.
I have seen some issues with Xcode8 / iOS 10 Simulators and keychain save/retrieval. See https://forums.developer.apple.com/thread/60617
AccountKit stores the accessToken securely in the keychain but there is an intermittent bug on Xcode8 / iOS 10 Simulators that makes read/write from keychain fail.
Can you test if this is also happening on a Device?
Apparently the problem goes away if you add the Shared Keychain Entitlement to your App, but this is still a bug on Apple.

Unable to like using Facebook iOS SDK

I am trying to implement like in my Objective C application. If I am not logged into Facebook, then after tapping Like button, application opens login screen. I will log into my account. Then screen goes light gray with gray logo of Facebook for a while (with 2 shortly showed grey facebook screens before that) and then I am redirected back into my app. If I am logged into Facebook when running application, everything is the same except not showing login screen.
So my problem is, that I am not getting correct confirmation dialog that should appear after logging into FB account and I am redirected back into my app. Like is not placed.
What can be cause of this behaviour?
I have placed all 3 needed rows into .plist and this is how I am creating like button (p_webView is my subclass of UIWebView):
if (p_webView.fbLikeButton == nil) {
p_webView.fbLikeButton = [[FBSDKLikeControl alloc] init];
}
p_webView.fbLikeButton.objectID = p_webView.article.url;
[p_webView.fbLikeButton setFrame:CGRectMake(p_webView.fbLikeButton.frame.origin.x, height + 5, p_webView.fbLikeButton.frame.size.width, p_webView.fbLikeButton.frame.size.height)];
[p_webView.fbLikeButton setCenter:CGPointMake(p_webView.frame.size.width / 2, p_webView.fbLikeButton.center.y)];
[p_webView.scrollView addSubview:p_webView.fbLikeButton];
More information - I have tried this on simulator (there I do not have FB app, so it was using Safari only). After loggin in, I have got error:
"The page you requested cannot be displayed at the moment. It may be temporarily unavailable, the link you clicked on may be broken or expired, or you may not have permission to view this page."
As it might be difficult to find solution - one needs to be in FB app as administrator, developer or tester for like button to work when testing app that has not been approved by Apple for using native like button yet.
You are doing right.
Maybe you are missing something:
You have to create fb app id and add it to iOS app. So you can open fb app when tap on Like button.(I think you did this)
You have to add your fb acc (using to login) to dev/test roles in your fb app. If not you will be pushed back to iOS app after login to fb (in fb app or safari). <--- I think your problem is here.
Ref: https://developers.facebook.com/docs/apps/test-users
If you want everyone can login and like, you have to Submit Your App for Review (with Native Like button). After that, everyone can use Like button.
For the fb app setting, in the "Status & Review" tab, turn on "Do you want to make this app and all its live features available to the general public?"
After that you can see this "This app is public and available to all users" in Dashboard tab, instead of "This app is in development mode and can only be used by app admins, developers and testers"

iOS Facebook Like Button Not Working With iOS App

Trying to add the Facebook Like Button to an iOS App. Followed the directions online and am seeing an issue.
Without the Facebook App Installed on Simulator (8.x, 7,x):
When pressing the F Like button, we see a transition to Facebook.com but then quickly returns to the iOS App. It does not go to the proper Facebook Like page where the user can like the URL passed.
In the iOS app, the openURL method is being called and the Facebook
wasHandled = [FBAppCall handleOpenURL: url sourceApplication: sourceApplication];
is being called and it returns YES.
Please note that we are also using the Facebook Login Button that is working fine in this app.
The user has already been authenticated with the Facebook Login Button at this point.
Any hints on this would be appreciated.
We are using Facebook iOS SDK 3.21.1
[Addition]
See this article
http://stackoverflow.com/questions/26529314/android-likeview-error
This is what we are seeing in the the URL Error Message in openURL
The like dialog is only available to developers and testers
Which kinda does not make sense? Regular users should be able to see the like dialog to like the item?
For Facebook Like Buttons on iOS and Android.
After you have integrated the latest SDK and you want to test....
1) You must use a Facebook Account that is either the Developer account for the app (the account that the Facebook ID for the app was created) OR a linked tester Facebook account to the Facebook Developer account.
2) You have to use this account to login with on for the App.
3) When testing a "BETA" banner will be on the target page.
4) If these are not in place, for iOS at least you will get an error message in the URL in the openURL routine in the AppDelegate. For Android you will get a "CANCEL" status in your onActivityResult routine.
The like dialog is only available to developers and testers
Hope this helps.
To fully enable the like button for production, please see Ming Li comments above.

phonegap + facebook plugin: login opens browser instead of popup (iOS)

I'm building a phonegap app with facebook authentication (https://github.com/davejohnson/phonegap-plugin-facebook-connect). I already have it working on android, but on iOS, I'm having this issue:
When I click 'login' (on the example index.html provided by the plugin), it opens a browser window and goes to facebook's mobile login page, instead of opening the facebook login dialog in a popup.
However, when I click 'wall post', it does open the expected popup (although it also seems buggy, login does not seem to work).
What can I do to make sure the popup opens for the login dialog, and not the browser?
Cheers,
Hoff
This is now the default behaviour for FBConnect when the device supports multi-tasking but does not have the FB app installed. The popup is only used on devices that do not support multi-tasking.
If you really want the popup you will have to go in to the FBConnect code and change it so that it always uses FBDialog.
The behaviour is documented here https://developers.facebook.com/docs/mobile/ios/build/#implementsso

Enhanced auth dialog on iOS doesn't complete login flow

I have an iOS app that uses the Facebook SDK for authorization. The existing app does not ask for manage_actions permission. I'm using fairly standard code to start the login flow:
NSArray permissions = [NSArray arrayWithObjects: #"email", #"publish_stream", #"user_education_history", #"rsvp_event",#"user_events,user_interests", nil];
[self.model.facebook authorize:permissions];
When I enable the enhanced auth dialog in the FBDev App and then try to sign into my app, I see a new mobile auth dialog prompting me to Add to Timeline. However, clicking the button on this screen does nothing. It doesn't show an error and doesn't return to my app.
Are there any known issues or workarounds for this flow using the new auth dialog?
(Saw this on an iPad with iOS 4.3)
Thanks,
Edit: One more detail, I saw this using the Facebook app for sign in, I haven't tried it using Safari.
This may have been caused because I didn't have the Bundle ID set through the DevApp.
After setting the iOS Bundle ID in the Settings -> Basic -> Native iOS App section of the DevApp, I have stopped being blocked by the Enhanced Auth Dialog.
In Facebook.m you have this method: - (void)authorizeWithFBAppAuth:(BOOL)tryFBAppAuth safariAuth:(BOOL)trySafariAuth. You can try setting both tryFBAuth and trySafariAuth to NO at the beginning of the method.

Resources