We built an IOS game and now it's in the testing process. When we tried to test the Invite Friends via Facebook in game, we found that our request only showed up in two places: 1. The Home Reminders section in the upper right hand corner of the main news feed home on the desktop web version of Faceook.com. 2. The notification jewel on the desktop web version of Faceook.com.
The inviting request NEVER appeared in the notification jewel on device( iPhone or iPad). Does anybody know what we should do? Please help us. Thank you.
Here are the codes:
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
// Optional parameter for sending request directly to user
// with UID. If not specified, the MFS will be invoked
[NSString stringWithCString:s.c_str() encoding:NSASCIIStringEncoding], #"to",
// Give the action object request information
//#"send", #"action_type",
#"111111111111", #"app_id",
//#"2222222222222", _#"objectid",
nil];
[FBWebDialogs presentRequestsDialogModallyWithSession:nil message:[NSString stringWithCString:words.c_str() encoding:NSUTF8StringEncoding] 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
if([[resultURL query] rangeOfString:#"request"].length == 0)
{
// User clicked the Cancel button
NSLog(#"User canceled request.");
}
else
{
// User clicked the Send button
//NSString *requestID = [urlParams valueForKey:#"request"];
//NSLog(#"Request ID: %#", requestID);
NSLog(#"User send request.");
}
}
}
}
];
Related
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 am trying to send invitation to my facebook friends through my application. I have friends list of my facebook friends in my application, I used FBWeb-dialog to send invitation to my friends. After selection my friends to whom I want to send request I am sending request them and its working fine, but my problem is that they are not receiving any notification to their wall. Can anybody tell me what should I do to notify them via notification. I am attaching my code also.
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:[arrSelectedFriends componentsJoinedByString:#","], #"suggestions",nil];
[FBWebDialogs presentRequestsDialogModallyWithSession:nil
message:#"User X” has invited you to join demoApp,Download the free app here."
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 have an invite feature to ask friends to download App.
These are my approach
1. The approach below required canvas page which i don't have.
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:nil];
[FBWebDialogs presentRequestsDialogModallyWithSession:nil
message:#"MCommerce - World Class App"
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.");
}
}}];
Post to friends wall. I am using FeedDialog and posting to friend wall is disabled by Facebook.
Any alternate way of sending an invite to ask friend download the App?
// Display the requests dialog
[FBWebDialogs presentRequestsDialogModallyWithSession:nil message:#"Learn how to make your iOS apps social." 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
NSDictionary *urlParams = [self parseURLParams:[resultURL query]];
if (![urlParams valueForKey:#"request"]) {
// User clicked the Cancel button
NSLog(#"User canceled request.");
}
else {
// User clicked the Send button
NSString *requestID = [urlParams valueForKey:#"request"];
NSLog(#"Request ID: %#", requestID);
}
}
}
}];
To clarify, requests won't show up in users wall/feed, but rather as notifications under the "globe" icon. However, requests won't show up in the notifications if:
1) The application is in Sandbox mode, and the receiver isn't a developer on the app. (any level)
2) The user has disabled requests for the app / notifications from FB. (https://www.facebook.com/settings?tab=notifications)
From personal experience, I would also add that Facebook tends to not show notifications for requests if you spam them too much or if you have low rating for posts. (Check facebook.com/insights)
I am sending requests from my app to the fb friends but i am not getting any notification on the wall of fb user whom i sent request ?
I am using FB SDK 3.2 (i hope its the latest)
Following is the code i am using to send request
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
friendList, #"to",
nil];
[FBWebDialogs presentRequestsDialogModallyWithSession:nil
message:[NSString stringWithFormat:#"I just smashed %d friends! Can you beat it?", 15]
title:#"Total Smashed Score"
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.");
}
}
}
];
The request dialog is properly shown, when i click send button the invites are sent but not shown on the users wall. Any type of help will be appreciated.
Regards.
Invites are never shown on the user's wall / timeline. There are only viewable in private by the user they are sent to. The will show up on the Requests page or as a notification to the user.
Here is my solution
//friendlist = NSString of fb id's
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
friendList, #"to",
nil];
[FBWebDialogs presentRequestsDialogModallyWithSession:nil
message:[NSString stringWithFormat:#"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 {
NSDictionary *urlParams = [self parseURLParams:[resultURL query]];
if (![urlParams valueForKey:#"request"]) {
// User clicked the Cancel button
NSLog(#"User clicked cancel button.");
} else {
nslog("succesfully sent invites");
}
}
}
}
];