Facebook Messenger creates a predefined message

I use fb-messenger: // compose to open Facebook Messenger Composer, but I am unable to post a predefined message to the composer.

Does anyone know the options?

+5
source share
1 answer

You must send content through the messenger using FBSDKShareKit.

Import FBSDKShareKit

#import <FBSDKShareKit.h> 

Create content and share

 FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init]; content.contentURL = [NSURL URLWithString:@"http://www.url.com"]; content.contentTitle = @"My link!"; content.contentDescription = @"Check out my link!"; [FBSDKMessageDialog showWithContent:content delegate:self]; 

You also need to coordinate your controller with FBSDKSharingDelegate

 #pragma mark - FBSDKSharingDelegate - (void)sharer:(id<FBSDKSharing>)sharer didCompleteWithResults:(NSDictionary *)results { } - (void)sharer:(id<FBSDKSharing>)sharer didFailWithError:(NSError *)error { } - (void)sharerDidCancel:(id<FBSDKSharing>)sharer { } 

Available Content:

  • FBSDKShareLinkContent
  • FBSDKSharePhotoContent
  • FBSDKShareVideoContent
+7
source

Source: https://habr.com/ru/post/1207415/


All Articles