Is it possible (using the iOS SDK ) to send a message to a pre-known list of people? I'm using this syntax, from (https://developers.facebook.com/docs/ios/share#message-dialog):
[FBDialogs presentMessageDialogWithLink:[NSURL URLWithString:#"https://developers.facebook.com/docs/ios/"]
handler:^(FBAppCall *call, NSDictionary *results, NSError *error) {
if(error) {
// An error occurred, we need to handle the error
// See: https://developers.facebook.com/docs/ios/errors
NSLog([NSString stringWithFormat:#"Error messaging link: %#", error.description]);
} else {
// Success
NSLog(#"result %#", results);
}
}];
From what I can tell, some usages of the share dialog support a to: parameter, but I don't see that here.
Edit: It really seems like the user picker dialog is not meant to be used in conjunction with the other messaging / sharing features of the SDK. This seems like a kind of absurd oversight.
Thanks!
Related
I am trying to share a link using the FB messenger. When i try to share the link to facebook i keep getting an error. I googled for an answer and the couple of solutions i found did not help since everything in the plist is correct. If anyone has any advice i would really appreciate it, been trying to solve this all day.
Error:
Invalid use of FBAppCall, fb839771929379526 is not registered as a URL Scheme. Did you set 'FacebookUrlSchemeSuffix' in your plist?
Code:
// Check if the Facebook app is installed and we can present
// the message dialog
FBLinkShareParams *params = [[FBLinkShareParams alloc] init];
params.link = [NSURL URLWithString:filePath];
params.name = #"My Video";
// If the Facebook app is installed and we can present the share dialog
if ([FBDialogs canPresentMessageDialogWithParams:params]) {
// Enable button or other UI to initiate launch of the Message Dialog
// Present message dialog
[FBDialogs presentMessageDialogWithLink:[NSURL URLWithString:#"https://developers.facebook.com/ios"] handler:^(FBAppCall *call, NSDictionary *results, NSError *error) {
if(error) {
// An error occurred, we need to handle the error
// See: https://developers.facebook.com/docs/ios/errors
NSLog([NSString stringWithFormat:#"Error messaging link: %#", error.description
]);
} else {
// Success
NSLog(#"result %#", results);
}
}];
} else {
// Disable button or other UI for Message Dialog
}
}
I have integrated Facebook Sharing of a link with a description, caption, etc via the Native Facebook App (if it is installed) using the code:
FBLinkShareParams *params = [[FBLinkShareParams alloc] initWithLink:[NSURL URLWithString:#"https://abcde.com"]
name:#"demo"
caption:#"demo"
description:#"demo"
picture:nil];
//Present share dialog
[FBDialogs presentShareDialogWithParams:params clientState:nil handler:^(FBAppCall *call, NSDictionary *results, 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 {
// Success
NSLog(#"result %#", results);
}
}];
When this method runs, and the native facebook app is installed, I get an option to share a post that has caption, link and description. When I click share and I go on FB to check it, it appears to only have the link?
Can someone suggest a possible fix?
Most likely it is due to newest Facebook sharing policy 2.3
I am using FBDialogs to share on facebook where I am sharing picture, name and description.
Below is my code used for sharing:-
[FBDialogs presentShareDialogWithLink:params.link
name:params.name
caption:nil
description:[NSString stringWithFormat:#"OMG I’m in LOVE with a puppy named %#.Come and say hi %#",sPuppyName , ITUNES_STORE_LINK]
picture:params.picture
clientState:nil
handler:^(FBAppCall *call, NSDictionary *results, 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 {
// Success
NSLog(#"result %#", results);
NSLog(#"result obtained %#",[results valueForKey:#"completionGesture"]);
if([[results valueForKey:#"completionGesture"] isEqualToString:#"cancel"]){
[[NSNotificationCenter defaultCenter] postNotificationName:#"facebookDidSharingCancel" object:self userInfo:nil];
}
else if([[results valueForKey:#"completionGesture"] isEqualToString:#"post"])
{
[[NSNotificationCenter defaultCenter] postNotificationName:#"facebookDidLogin" object:self userInfo:nil];
}
}
}];
I am able to see description on share dialog while sharing but on Facebook site I am not able to see description.
Searched a lot but cant find any way so please anybody help me.
Thanks in advance
I've integrate facebook invite to my adroid app,with RequestsDialogBuilder as what facebook doc said.After read their doc thoroughly for several times,I haven't found the coresponding doc about ios.And there are also docs about facebook share.How about facebook-invte?
I also found ios Sample on github.
But neither do i found sample about invite~
Maybe I have to call Graph api.
For inviting users you can use the following code after adding the facebook-sdk
[FBWebDialogs
presentRequestsDialogModallyWithSession:sharedFacebookHelper.session
message:#"Your invite message"
title:nil
parameters:nil
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 canceled.
NSLog(#"User cancelled.");
} else {
// Handle the publish feed callback
}
}
}];
I am writing facebook interaction code in swift language for iOS. I have converted login and other code but stuck with sharing methods.
I am not able to find requestWithGraphPath method of FBRequest class in swift. If somebody know about this then please help me here. I have searched for solution on web but fail to find.
This is my sharing code in Objective-C
FBRequest *req=[FBRequest requestWithGraphPath:#"me/feed" parameters:params HTTPMethod:#"POST"];
[req startWithCompletionHandler:^(FBRequestConnection *connection, id result, NSError *error{
if (!error) {
// Sucess! Include your code to handle the results here
NSLog(#"Successful sharing");
} else {
// An error occurred, we need to handle the error
// See: https://developers.facebook.com/docs/ios/errors
NSLog(#"Error while sharing data");
}
}];
Thank you in advance.