Facebook IOS SDK Frictionless Requests - ios

There appears to be no way of setting frictionless requests as on for facebook ios sdk. For Javascript inplementations this can be done in the fb.init method.
The only other reference to my problem is Facebook Requests Dialog: Frictionless Requests in native iOS app possible? where it states that frictionless just works when not in sandbox mode.
Has anyone else found this to be the case?

This call enables frictionless requests:
[facebook enableFrictionlessRequests];
But it is not enough to prevent all dialogs from appearing briefly. Since the frictionless recipient cache is by default not loaded until the first dialog appears. Once the first dialog appears, the frictionless recipient list will be loaded and subsequent dialogs won't appear. However, you can call
[facebook reloadFrictionlessRecipientCache];
after a successful login to have the frictionless recipient cache ready before the first dialog appears.
Franco

Frictionless requests can be turned on by setting the "frictionless" parameter of the apprequests dialog to "1". For example;
// create a dictionary for our dialog's parameters
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithCapacity: 7];
// set the frictionless requests parameter to "1"
[params setObject: #"1" forKey:#"frictionless"];
// ... add other parameters ...
// show the request dialog
[facebook dialog:#"apprequests" andParams:params andDelegate: nil];
I think this also answers Frictionless Requests on iOS - how?

In newer version (2/25/2012 and newer) of the facebook-ios-sdk, there is a new FBFrictionlessRequestSettings which you can enable once, and then all future apprequests will automatically be frictionless. So when your app starts, you should do:
[facebook enableFrictionlessRequests];
I prefer this over manually setting the #"frictionless" key to 1 because when you send an apprequest, you will still briefly see the FBDialog pop up and then disappear. If you do 'enableFrictionlessRequests', Facebook.m will automatically set the 'isViewInvisible' param for you and prevent the FBDialog from flashing.

Now with the Facebook iOS SDK 3.2.1, you can use frictionless requests without using the deprecated headers. Please check out the BooleanOGSample for implementation detials.

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

Facebook authorize dialog has no cancel button?

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.

Facebook iOS SDK - Simple status update with Dialog

I'm trying to post a simple status update on the Facebook iOS SDK. At the moment, if I include the link parameter, everything will work:
NSMutableDictionary *params =
[NSMutableDictionary dictionaryWithObjectsAndKeys:
#"Name here", #"name",
#"Caption here", #"caption",
#"Status update", #"description",
#"http://www.apple.com.",#"link",
nil];
[facebook dialog:#"feed"
andParams:params
andDelegate:self];
But once I remove link none of the remaining parameters are acknowledged and I'm left with a blank message. I simply want to perform the same sort of post you can achieve with Facebook request whereby providing a string for the message parameter is enough for the status update.
Not sure where I'm going wrong.
Actually posing of status messages with feed dialog isn't an option and it's actually not intended to be user like this.
You can consider one of the options:
Requesting publish_stream permission and than issue POST request to Graph API with message parameter (feed connection of user object), see statuses connection documentation (IMO it seems as an good way to go, if you don't afraid to ask publish_stream permission).
Open Facebook App with publishing view (and text pre-filled?), this is described in answer to "How to programmatically open iOS Facebook app with pre-populated status?"
Note: I'm not completely sure about inability to achieve this with feed dialog, so I may be wrong, anyone who know this isn't the case please correct me.

Dialog 'apprequests' friend invites send OK but never get through. (iOS)

I'm having problems getting friend invites working. They seem to be being sent OK (I don't get any errors from the iOS delegates) but the invites never appear on the receivers FB account. I'm using iOS SDK and logging in with test users. The code I'm using to create the invite dialog is:
NSMutableDictionary* dict = [NSMutableDictionary dictionary];
[dict setValue:#"Accept my invite" forKey:#"message"];
[_facebook dialog:#"apprequests" andParams:dict andDelegate:self];
This brings up the dialog where I can select friends to invite. When I hit Send the dialog vanishes and no errors are returned. Problem is that the invites are never received by the people I send them to.
I have set my canvas url, so according to other posts on SO everything should be working fine... but they are not.
Thanks for any suggestions.
Actually this is explained in Requests documentation:
User to User Requests are only available for Canvas apps, not websites, as accepting a request will direct the user to the Canvas Page URL of the app that sent the Request.
Same stated about App to User requests as well.
This is probably not only because Canvas URL, but also application type (I guess it shouldn't be native to display request)
In fact requests are sent but users not able to see 'em. You can access requests (via Graph API) for users of your application and display 'em in your app.
Solution: (Sending Invitations, getting ID in response, but no Notification alert or request on facebook.......).
Please first remove all requests from your facebook. Then send invitation.(If getting ID in response), then it will be shown 100%.
This is a problem with facebook, it doesn't shows latest requests on top if max notifications/requests reached.(It hides new notifications/request).

iOS Facebook api, apprequests sent but not receiving?

I'm currently working on an iOS app, and I use apprequests to bring up the dialog to send request. I can see everything working fine (I got the dialog complete thing) but user is not getting the request! I'm working with a test FB app (not public), I'm thinking if there's something I'm missing on setting up the FB app? Or is there a specify permission I have to enable?
Here is a little piece of my code:
-(void)appRequestsWithMessage:(NSString )message {
NSMutableDictionary params = [NSMutableDictionary dictionaryWithObjectsAndKeys: message, #"message", nil];
[facebook dialog:#"apprequests"
andParams:params
andDelegate:self];
}
To allow App Requests to be shown in Facebook, you have to enable "App on Facebook" in Apps Settings and supply a "Canvas URL" and a "Secured Canvas URL".
Have you added the receiving user as a tester on your Facebook app admin page? As long as you're in sandbox mode, only users added as testers (or any other position) can see, interact with and receive requests from our app.
Check the settings page for your app.

Resources