Ios 快速实施FBSDKAppInviteDialogDelegate不起作用

Ios 快速实施FBSDKAppInviteDialogDelegate不起作用,ios,facebook,swift,facebook-ios-sdk,Ios,Facebook,Swift,Facebook Ios Sdk,我试图在我的类上实现协议FBSDKAppInviteDialogDelegate,但是xcode向我显示了一个错误,它说“类型MyClass不符合协议‘FBSDKAppInviteDialogDelegate’” 议定书的定义: @protocol FBSDKAppInviteDialogDelegate <NSObject> /*! @abstract Sent to the delegate when the app invite completes without error

我试图在我的类上实现协议FBSDKAppInviteDialogDelegate,但是xcode向我显示了一个错误,它说“类型MyClass不符合协议‘FBSDKAppInviteDialogDelegate’”

议定书的定义:

@protocol FBSDKAppInviteDialogDelegate <NSObject>

/*!
@abstract Sent to the delegate when the app invite completes without error.
@param appInviteDialog The FBSDKAppInviteDialog that completed.
@param results The results from the dialog.  This may be nil or empty.
*/
- (void)appInviteDialog:(FBSDKAppInviteDialog *)appInviteDialog didCompleteWithResults:(NSDictionary *)results;

/*!
@abstract Sent to the delegate when the app invite encounters an error.
@param appInviteDialog The FBSDKAppInviteDialog that completed.
@param error The error.
*/
- (void)appInviteDialog:(FBSDKAppInviteDialog *)appInviteDialog didFailWithError:(NSError *)error;

@end
要调用邀请对话框,请执行以下操作:

var inviteDialog:FBSDKAppInviteDialog = FBSDKAppInviteDialog()
if(inviteDialog.canShow()){
    let appLinkUrl:NSURL = NSURL(string: "http://mylink.com")!
    let previewImageUrl:NSURL = NSURL(string: "http://mylink.com/image.png")!

    var inviteContent:FBSDKAppInviteContent = FBSDKAppInviteContent(appLinkURL: appLinkUrl)
    inviteContent.previewImageURL = previewImageUrl

    inviteDialog.content = inviteContent
    inviteDialog.delegate = self
    inviteDialog.show()
}
procol方法的实施:

//function of FBSDKAppInviteDialogDelegate
func appInviteDialog(appInviteDialog: FBSDKAppInviteDialog!, didCompleteWithResults results: NSDictionary!){
    // my code here
}
//function of FBSDKAppInviteDialogDelegate
func appInviteDialog(appInviteDialog: FBSDKAppInviteDialog!, didFailWithError error: NSError!){
    // my code here
}
“邀请”对话框起作用。但是如果没有协议,我就不能得到结果


我在这里遗漏了什么?

问题在于NSDictionary。以下内容适用于我:

func appInviteDialog(appInviteDialog: FBSDKAppInviteDialog!, didCompleteWithResults results: [NSObject : AnyObject]!) {
    println("Complete invite without error")
}

func appInviteDialog(appInviteDialog: FBSDKAppInviteDialog!, didFailWithError error: NSError!) {
    println("Error in invite \(error)")
}
看起来很像。我认为这与你的协议方法的签名有关。
func appInviteDialog(appInviteDialog: FBSDKAppInviteDialog!, didCompleteWithResults results: [NSObject : AnyObject]!) {
    println("Complete invite without error")
}

func appInviteDialog(appInviteDialog: FBSDKAppInviteDialog!, didFailWithError error: NSError!) {
    println("Error in invite \(error)")
}