Facebook Messenger Compose Predefined Message

一曲冷凌霜 提交于 2019-12-23 11:50:23

问题


I am using fb-messenger://compose to open Facebook Messenger Composer, but I can't manage to put predefined message into the composer.

Does somebody know the parameters?


回答1:


You should send content via 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 conform your controller to the 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 contents are:

  • FBSDKShareLinkContent
  • FBSDKSharePhotoContent
  • FBSDKShareVideoContent


来源:https://stackoverflow.com/questions/27064802/facebook-messenger-compose-predefined-message

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!