无法将Messenger窗口与自定义按钮合并

时间:2018-08-05 00:16:20

标签: facebook facebook-messenger facebook-access-token facebook-webhooks facebook-ios-sdk-4.0

在登录iOS应用程序内的FB后,我有一个“通过Facebook邀请”按钮,该按钮应在单击时打开一个Facebook Messenger窗口或一个包含Facebook朋友的列表,以发送我决定键入的内容来选择朋友(即我的应用程序中的Messenger)。

相应的.xib文件上的相关“通过Facebook邀请”代码是

<button opaque="NO" contentMode="scaleToFill" misplaced="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="GP8-Yf-a9u">
                                    <rect key="frame" x="22" y="6" width="275" height="50"/>
                                    <color key="backgroundColor" red="0.19607843459999999" green="0.30980393290000002" blue="0.52156865600000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                    <constraints>
                                        <constraint firstAttribute="width" constant="275" id="9hT-4c-YgK"/>
                                        <constraint firstAttribute="height" constant="50" id="OEW-6u-xyi"/>
                                    </constraints>
                                    <fontDescription key="fontDescription" name="ProximaNova-Bold" family="Proxima Nova" pointSize="17"/>
                                    <inset key="titleEdgeInsets" minX="40" minY="0.0" maxX="0.0" maxY="0.0"/>
                                    <inset key="imageEdgeInsets" minX="20" minY="0.0" maxX="0.0" maxY="0.0"/>
                                    <state key="normal" title="Invite via Facebook" image="share_facebook">
                                        <color key="titleColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                    </state>
                                    <userDefinedRuntimeAttributes>
                                        <userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
                                            <integer key="value" value="4"/>
                                        </userDefinedRuntimeAttribute>
                                    </userDefinedRuntimeAttributes>
                                    <connections>
                                        <action selector="handleFacebookShare:" destination="-1" eventType="touchUpInside" id="ZRQ-5x-fbd"/>
                                    </connections>
                                </button>

其中相应的句柄FacebookShare:在相应的ViewController.m中是上面的

- (IBAction)handleFacebookShare:(id)sender {
//    SLComposeViewController *controller = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
//    NSString *message = [SocialShareHelper messageFBFromUser:[BMUserManager sharedInstance].selfProfile.username];
//    [controller setInitialText:message];
//    [controller addURL:[NSURL URLWithString:[[BMUserManager sharedInstance] shareAppLink]]];
//    [controller addImage:[UIImage imageNamed:@"share_logo"]];
//    [controller setCompletionHandler:[self createGAIHandler:@"social" forAction:@"facebook"]];
//    
//    [self presentViewController:controller animated:YES completion:nil];
    FBSDKAppInviteContent *content =[[FBSDKAppInviteContent alloc] init];
    content.appLinkURL = [NSURL URLWithString:@"https://fb.me/**"];
    //optionally set previewImageURL
    content.appInvitePreviewImageURL = [NSURL URLWithString:@"http://**"];
    // present the dialog. Assumes self implements protocol `FBSDKAppInviteDialogDelegate`
    [FBSDKAppInviteDialog showFromViewController:self withContent:content delegate:self];

任何专家都可以提供一些初步提示,说明从何处开始调试与Messenger应用程序的连接吗?

如果我使用网络挂钩,那么FBSDK回调URL和“验证令牌”值应如何设置网络挂钩以使用Messenger?

任何人都可以澄清上面的代码吗?

(我没有设置带有漫游器的页面来回答查询。)

0 个答案:

没有答案