Facebook Messenger撰写预定义消息

时间:2014-11-21 15:30:03

标签: ios objective-c url-scheme

我正在使用fb-messenger://撰写打开Facebook Messenger Composer,但我无法将预定义的消息放入作曲家。

有人知道参数吗?

1 个答案:

答案 0 :(得分:8)

您应该使用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];

您还需要使控制器符合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