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.");
}
}}];
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 need to invite my friend from my ios native Application. I read documentation and used following code. I view popup, select my friend and send invite. Callback method says "Request Sent." but my friend don't receive nothing invite. Why?
[FBWebDialogs presentRequestsDialogModallyWithSession:nil
message:[NSString stringWithFormat:#"I just smashed %d friends! Can you beat it?", 2]
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.");
}
}}];
Can you help me please?
Thanks
When users are invited they receive "app requests" which appear under app requests Facebook page, rather than under the "globe" as you may expect. Have whoever is testing the code go check under "app requests" in the "app center." (For me the app center appears on the left side of my facebook home page.)
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 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?