I'm currently trying to add the Facebook SDK to the version of my iOS app. The login, logout, sharing, and query functions currently work, but it's hard for me to get the MessageDialog function. The Facebook app and the Facebook Messenger app are currently installed on my devices. However, every time I call "FBDialog canPresentMessageDialogWithParams: params", it returns false.
I assume that this function does not work while the application is still in development mode, but this is just an assumption. Does anyone know if the message dialog works with applications that are under development? Or do you have ideas on what I'm doing wrong?
I also included my code in case I made some kind of bone errors. Any help is much appreciated!
// Check if the Facebook app is installed and we can present the share dialog FBLinkShareParams *params = [[FBLinkShareParams alloc] init]; params.link = [NSURL URLWithString:@"https://www.facebook.com/"]; params.name = @"Flash Bear"; params.caption = nil; params.picture = nil; params.linkDescription = @"I'm playing Flash Bear. Why don't you come join me?"; // If the Facebook Messenger app is installed and we can present the share dialog if ([FBDialogs canPresentMessageDialogWithParams:params]) { // Present message dialog [FBDialogs presentMessageDialogWithParams: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 messaging link: %@", error.description); } else { // Success NSLog(@"result %@", results); } }]; } else { // Present the feed dialog // Put together the dialog parameters UIAlertView *message = [[UIAlertView alloc] initWithTitle:@"Sorry!" message:@"There was an error connecting to FB Messenger. Please make sure that it is installed." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; [message show]; }
source share