Facebook authorize dialog has no cancel button? - ios

We are using the legacy headers from the Facebook iOS SDK (3.1.1), as we don't want the user to be able to leave the app. This is a particular issue for us, as we are using GameKit and iOS kills the connection rather quickly after leaving the app (a few seconds is enough)
What I am doing right now, to show the login dialog is:
m_facebook = [[Facebook alloc] initWithAppId:m_fbAppId andDelegate:self];
NSArray * permissions = [NSArray arrayWithObjects:#"publish_stream",nil];
[m_facebook authorize:permissions];
However the dialog doesn't have a cancel button, so the user has no way of leaving it, except with a successful login. Is there a fix?
Best,
Gorm

If you use an older version of the Facebook SDK, the 'X' button will not appear at the top-left of the authorization dialog. Updating to the latest SDK solved the issue for me.

Related

Is it possible to invite friends without showing Facebook dialog?

I am building an iOS app that is using facebook to gain traction. I would like to invite some friends, that user selects from list, but without showing facebook confirmation dialog, i want that to happen behind the scenes.
Reading documentation there is property frictionlessRequestsEnabled, but even that shows dialog, where i have option to disable showing dialog in the future. Is there some other way to do this?
Many apps invite all of your friends without showing the Facebook Dialog Box. It is possible by modifying the FBSDK. Simply clone the FBSDK repository to your local machine, edit in Xcode and Command+B to build the framework for your own use. The following classes are relevant to inviting in the FBSDK for iOS:
FBSDKWebDialogView
FBSDKWebDialog
FBSDKGameRequestDialog
To get the URL Generated for the dialog view:
In FBSDKWebDialog.m in -(BOOL)show:
NSURL *URL = [self _generateURL:&error];
This is the URL generated to load the web view. It is possible to use this URL without the web dialog view, as long as it is only generated once (access token gets reset every time the URL is generated) and is used on a mobile browser.
To Invite Without The Dialog Box
You can use javascript to simulate clicking the go button by doing something like this (assuming you have specified your parameters and recipients properly and your app is already set up through Facebook)
In FBSDKWebDialogView.m in - (void)webViewDidFinishLoad:(UIWebView *)webView :
[NSTimer scheduledTimerWithTimeInterval:.1 target:[NSBlockOperation blockOperationWithBlock:^{ NSString * jsCallBack = [NSString stringWithFormat:#"document.getElementById(\"u_0_0\").click();"];
[webView stringByEvaluatingJavaScriptFromString:jsCallBack];
[webView stringByEvaluatingJavaScriptFromString:#"document.getElementById(\"u_0_0\").click();"]; }] selector:#selector(main) userInfo:nil repeats:NO ];
As long as the webView is present somewhere, you may be able to do these actions with little interference for the user. You could set the webView frame to be very small, or potentially hide the view altogether.
Facebook is however, policing hard against this sort of thing and it likely that that there will be more protection against this in the future.
FBSDK Repo Here:
https://github.com/facebook/facebook-ios-sdk

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 phonegap-plugin-facebook-connect vs Facebook iOS Application

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

Facebook iOS SDK Feed Dialog issue after authentication

I seem to be having an issue with the feed dialog, which I haven't had before.
I suspect it's because of iOS 5, but I'm not sure.
If the user needs authentication, he's being redirected to the Facebook app, and then returns to my app.
Afterwards, the user clicks a "Share" button, and the feed dialog appears.
But suddenly, it disappears.
If the user clicks "Share" again, the feed dialog is working just fine. It's just that first time, after returning to the app from authentication...
The code associated with the "Share" button is simply this:
if ([facebook isSessionValid]) {
[facebook dialog:#"feed" andParams:params andDelegate:self];
}
The params variable is always set to the correct values and is not nil.
If the session is not valid, the user is being sent to the authentication method.
I tried also to comment out an IF Statement in FBDialog.m which I've read somewhere, but it didn't work out.
Anyone experienced the same issue?
Thanks!
EDIT:
I'm pretty sure it's because of iOS 5 now, since I've built the project on my iPad 2, which is running iOS 4.3, and it works fine from the first time.
EDIT 2:
It's suddenly working fine. ...and I didn't change anything O_O
I had the same issue and this code change fixed it https://github.com/deyton/facebook-ios-sdk/commit/c1d3702f7c2042549c3bee050ceade7fb6f593a4

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