我正在使用fb-messenger://compose打开Facebook Messenger Composer,但无法管理将预定义的消息放入Composer。

有人知道参数吗?

最佳答案

您应该使用FBSDKShareKit通过Messenger发送内容。

导入FBSDKShareKit

#import <FBSDKShareKit.h>

创建内容并共享
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];

您还需要使 Controller 符合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 {

}

可用的内容有:
  • FBSDKShareLinkContent
  • FBSDKSharePhotoContent
  • FBSDKShareVideoContent
  • 09-25 17:00