我对Facebook消息共享功能有疑问。
我正在通过Facebook消息共享具有深层链接的标题,图像和字幕。
但是,快速版本没有通用的模板元素。
已弃用吗?
如何与Facebook Messenger共享常规模板内容?
正式文件示例代码
FBSDKShareMessengerURLactionButton *urlButton = [[FBSDKShareMessengerURLactionButton alloc] init];
urlButton.title = @"Visit Facebook";
urlButton.url = [NSURL URLWithString:@"https://www.facebook.com"];
FBSDKShareMessengerGenericTemplateElement *element = [[FBSDKShareMessengerGenericTemplateElement alloc] init];
element.title = @"This is a Cat Picture";
element.subtitle = @"Look at this cat,wow! Amazing.";
element.imageURL = [NSURL URLWithString:@"https://static.pexels.com/photos/126407/pexels-photo-126407.jpeg"];
element.button = urlButton;
FBSDKShareMessengerGenericTemplateContent *content = [[FBSDKShareMessengerGenericTemplateContent alloc] init];
content.pageID = // Your page ID,required for attribution
content.element = element; // <<<< … ? This part is missing in the swift version
FBSDKmessagedialog *messagedialog = [[FBSDKmessagedialog alloc] init];
messagedialog.shareContent = content;
if ([messagedialog canShow]) {
[messagedialog show];
}
https://developers.facebook.com/docs/sharing/messenger/#-----