I have my app set up to send facebook app requests. I get the popup screen to pick friends and when I click on send button, the popup disappears. And I get a request ID printed out in the console as well.
Although the friends that I have selected to send the request has not received the app request.
I have facebook sdk 3.1 which works well with other activities such as posting to user's walls etc.
Possible duplicates:
Facebook iOS SDK - Sending a facebook user an app request
How to Send App request to facebook friends through facebook iOS sdk?
The answer on the second link provides a step by step procedure on how to fix this.
Make sure your facebook app id is same in both developer page and info in xcode next, enable sandbox mode and must fill canvas url [under app on facebook category] in developer page.
NSString *facebookID = #"Your friend facebook id";
NSMutableDictionary* params =
[NSMutableDictionary dictionaryWithObject:facebookID forKey:#"to"];
NSString *message = #"SOME_MESSAGE";
NSString *title = #"TITLE";
[FBWebDialogs presentRequestsDialogModallyWithSession:nil
message:message
title:title
parameters:params handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
if (error)
{
// Case A: Error launching the dialog or sending request.
NSLog(#"Error sending request.");
}
else
{
if (result == FBWebDialogResultDialogNotCompleted)
{
// Case B: User clicked the "x" icon
NSLog(#"User canceled request.");
}
else
{
NSLog(#"Request Sent. %#", params);
}
}}];
Related
i have integrate the facebook sdk for post something on facebook.Its working for only single facebook-id which is used for integrating facebook it in my application, not working for other.
this is my code
-(IBAction)postOnFacebook:(id)sender {
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:#"Sharing Tutorial", #"name",#"Build great social apps and get more installs.", #"caption", #"Allow your users to share stories on Facebook from your app using the iOS SDK.", #"description",#"https://developers.facebook.com/docs/ios/share/", #"link",#"http://i.imgur.com/g3Qc1HN.png", #"picture",nil];
// Show the feed dialog
[FBWebDialogs presentFeedDialogModallyWithSession:nil
parameters:params
handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
if (error) {
// An error occurred, we need to handle the error
// See: https://developers.facebook.com/docs/ios/errors
NSLog(#"Error publishing story: %#", error.description);
} else {
if (result == FBWebDialogResultDialogNotCompleted) {
// User cancelled.
NSLog(#"User cancelled.");
} else {
// Handle the publish feed callback
NSDictionary *urlParams = [self parseURLParams:[resultURL query]];
if (![urlParams valueForKey:#"post_id"]) {
// User cancelled.
NSLog(#"User cancelled.");
} else {
// User clicked the Share button
NSString *result = [NSString stringWithFormat: #"Posted story, id: %#", [urlParams valueForKey:#"post_id"]];
NSLog(#"result %#", result);
}
}
}
}];
}
// A function for parsing URL parameters returned by the Feed Dialog.
- (NSDictionary*)parseURLParams:(NSString *)query {
NSArray *pairs = [query componentsSeparatedByString:#"&"];
NSMutableDictionary *params = [[NSMutableDictionary alloc] init];
for (NSString *pair in pairs) {
NSArray *kv = [pair componentsSeparatedByString:#"="];
NSString *val =
[kv[1] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
params[kv[0]] = val;
}
return params;
}
this meth
Error come when i use another id for login
You are using the publish_action permission which can be made availaible to all users only after approval from facebook.
Currently you might have created the facebook app in your account and with that account id you will be able to post to facebook. This is because of the reason that facebook gives all the permissions to users who are added as Developers/Testers in the App Dashboard.
You can add people to your app as Testers/Developers by following the steps as described below
You'll need to be an admin to give someone a role on your Page. If the person is your Facebook friend:
Go to your Page and tap More.
Tap Edit Settings > Page Roles.
Tap Add Person to Page. You may need to enter your password to continue.
Begin typing a friend's name and tap their name from the list that appears.
Tap to choose a role > Add.
If the person isn't your Facebook friend, you can log into Facebook from a computer and add them by entering their email address.
Depending on their settings, the person may receive a notification or an email when you give them a role.
These users who are added will have all the permission that you are requesting.
If you want the permissions to be availaible to everyone, your facebook app should be approved and for that you have to submit your app to facebook for review. The guidelines for facebook app submision can be found from the following link
https://developers.facebook.com/docs/apps/review
Hope this helps you
I'm not sure if I understood your question.
But, for what I'm seeing. If you have created app at facebook (to integrate with your iOS app) you have to use the facebook app ID only, presented at Facebook.
Or, if this error is because you are trying to login with another facebook account. This is happening probably because you did not publish your app yet (facebook app). So it's not available to everyone, but its ok because you probably don't want to make it available right now. So you just need to go to the left menu at Roles in your facebook app page and add test users (the account that you're trying to login) or add as administrator.
I was using ios friend request dialog from facebook to send invitation to user for my app. After facebook announced closing of their API it stopped working, Does anyone have an idea how to invite people for application for ios.
You can use this code.
- (void)inviteFriendsOfFacebook
{
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:[mArrTempSelected componentsJoinedByString:#","], #"suggestions", nil];
[FBWebDialogs presentRequestsDialogModallyWithSession:nil
message:textView.text
title:nil
parameters:params
handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
if (error) {
// Case A: Error launching the dialog or sending request.
NSLog(#"Error sending request.");
} else {
if (result == FBWebDialogResultDialogNotCompleted) {
// Case B: User clicked the "x" icon
NSLog(#"User canceled request.");
}
else
{
[Helper showAlertForMessage:#"Invitation Sent Successfully." title:nil cancelButton:#"Ok" otherButton:nil andDelegate:nil withTag:0];
}
}}];
}
Facebook has announced that this will work only for Games application, though one can do this. Just set canvas url for app on Facebook app and use faecbook request dialog. This is very usefull feature for any app.Facebook is working on this feature to make available easily.
I'm trying to send a comment using Facebook iOS SDK to my FB friends.
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:[[_usersFB valueForKey:#"selectValue"] componentsJoinedByString:#","], #"to",
nil];
[FBWebDialogs
presentRequestsDialogModallyWithSession:nil
message:#"Test Comment"
title:nil
parameters:params
handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
if (error) {
// Error launching the dialog or sending the request.
NSLog(#"Error sending request.");
} else {
if (result == FBWebDialogResultDialogNotCompleted) {
// User clicked the "x" icon
NSLog(#"User canceled request.");
} else {
// Handle the send request callback
}
}
}];
I'm using FB SDK v3.5.3.
I see all the friends in the FBDialog but when I tap on the send button the callback returns no error assuming it worked but my selected friends hasn't received anything.
FYI - My FB app is not in sandbox mode.
Any pointers would be greatly appreciated.
Cheers
Make sure you open the facebook page or app in an iPhone device when you check if it worked.
The notifications will not appear on facebook on on desktop browsers, only on iPhones.
I hope it helps.
I've implemented the basic function to send a invitation request to players' friends to play my game app on iOS devices.
I've followed the instructions here: https://developers.facebook.com/docs/ios/ios-sdk-games/requests/
Everything works fine, I can send requests and friends receive notifications. The problem is that I cannot get the request dialog to appear the way is shown in the above link, in particularly I cannot get the request's preview in the dialog. Does this depend on SDK version? I am currently running with version SDK 3.5.3. Or the problem is somewhere else? any help is greatly appreciated. Thanks
Here's the code that calls the function:
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:nil];
[FBWebDialogs presentRequestsDialogModallyWithSession:nil message:[NSString stringWithFormat:#"Come and play CSR with me!"]
title:nil
parameters:params
handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
if (error) {
// Case A: Error launching the dialog or sending request.
NSLog(#"Error sending request.");
} else {
if (result == FBWebDialogResultDialogNotCompleted) {
// Case B: User clicked the "x" icon
NSLog(#"User canceled request.");
} else {
NSLog(#"Request Sent.");
}
}}];
I am using Facebook SDK to connect Facebook in my app. User can send invitation to their friends. (Using the Requests dialog provided by FB SDK).
https://developers.facebook.com/docs/tutorials/ios-sdk-games/requests/
And I'm trying to keep the friend list clear if the friend is already invited (ever the friend is accepted or not), hide the friend from the list. But I can't find the way to do this. Is there a way to do this?
Facebook documentation is horrible but I found it is possible exclude authenticated friends as follows:
// See https://developers.facebook.com/docs/games/requests/v2.1 for explanation of the possible parameter keys
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
// Optional parameter for sending request directly to user
// with UID. If not specified, the MFS will be invoked
// #"RECIPIENT_USER_ID", #"to",
// Give the action object request information
// #"send", #"action_type",
// #"YOUR_OBJECT_ID", #"object_id",
#"app_non_users", #"filters",
nil];
[FBWebDialogs
presentRequestsDialogModallyWithSession:nil
message:#"Join me!"
title:#"Invite Friends"
parameters:params
handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
if (error) {
// Case A: Error launching the dialog or sending request.
NSLog(#"Error sending request.");
} else {
if (result == FBWebDialogResultDialogNotCompleted) {
// Case B: User clicked the "x" icon
NSLog(#"User canceled request.");
} else {
NSLog(#"Request Sent.");
}
}
}];
#"app_non_users", #"filters", is the important part!
I dont think you can exclude friends that have had the request sent to them but you can suggest friends to populate in that list. Perhaps if you already know who you have sent the request to you can populate the list with the rest of your friends.