我正试图打开Facebook Messenger,从我的iOS应用程序发送消息。我目前正在运行FaceBook SDK版本4.37.0。根据iOS-共享,这应该是可能的。上面写着
人们还可以通过Messenger Expression Platform将您的应用程序中的内容共享到Facebook Messenger,或从iOS SDK中的共享消息对话框中共享。
如果您单击消息对话框的链接,它会为您提供以下示例:
FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init];
content.contentURL = [NSURL URLWithString:myFacebookURL];
content.quote = @"My message";
[FBSDKMessageDialog showWithContent:content delegate:self];
我已经实现了这一点以及以下的FBSDKSharingDelegate委派方法
- (void)sharer:(id<FBSDKSharing>)sharer didCompleteWithResults:(NSDictionary *)results
{
NSLog(@"complete");
}
- (void)sharer:(id<FBSDKSharing>)sharer didFailWithError:(NSError *)error
{
NSLog(@"Sharer Error");
}
- (void)sharerDidCancel:(id<FBSDKSharing>)sharer
{
NSLog(@"Cancelled");
}
委托方法永远不会被调用。我所期望的是,Facebook Messenger对话框将打开,允许我选择一个朋友发送消息。但什么都没有打开。并且没有记录任何错误。
我确实知道facebook收到了一些东西,因为我收到了以下信息:
FBSDKLog: param {
"advertiser_id" = "xxxxxxxxx";
"advertiser_tracking_enabled" = 1;
"anon_id" = "xxxxxxxx";
"application_
tracking_enabled" = 1;
"custom_events" = "[{"_eventName":"fb_mobile_content_view","_logTime":1541721304,"fb_description":"MY FEATURE Sent","_ui":"no_ui"},{"_ui":"no_ui","_eventName":"fb_messenger_dialog_share_show","_logTime":1541721310,"_implicitlyLogged":"1","fb_dialog_share_content_type":"Status"}]";
event = "CUSTOM_APP_EVENTS";
extinfo = "["i2","com.myApp","1","8.3.6","12.0.1","iPhone10,6","en_US","CST","AT&T",375,812,"3.00",6,60,8,"America\/Chicago"]";
"url_schemes" = "["myappID","myscheme1","myscheme2","myscheme3"]";
}
任何帮助或建议都将不胜感激。
FBSDKMessageDialog.show(with: FBSDKShareLinkContent(), delegate: nil)
我也有同样的问题,但实验上我只通过FBSDKShareLinkContent((作为内容参数,信使应用程序启动
您还应该在LSApplicationQueriesSchemes 下的Info.plist中添加fb-messenger共享api密钥