我尝试使用本指南尝试使用Facebook App Invites: Facebook App Invites iOS我的代码如下:
@IBAction func tapInviteFriends() {
if AccessToken.current?.authenticationToken == nil {
AccessToken.current = AccessToken.init(authenticationToken: stringValue(object: UserDefaults.standard.string(forKey: “facebookToken”)))
}
let inviteDialog:FBSDKAppInviteDialog = FBSDKAppInviteDialog()
if(inviteDialog.canShow()){
let appLinkUrl:URL = URL(string: "https://fb<dot>me/1358637537516578")!
let previewImageUrl:URL = URL(string: "http://is4.mzstatic.com/image/thumb/Purple122/v4/e6/a2/1a/e6a21ada-b51a-17fe-4522-6618f864cc80/source/175x175bb.jpg")!
let inviteContent:FBSDKAppInviteContent = FBSDKAppInviteContent()
inviteContent.appLinkURL = appLinkUrl
inviteContent.appInvitePreviewImageURL = previewImageUrl
inviteContent.destination = .facebook
inviteDialog.content = inviteContent
inviteDialog.delegate = self
inviteDialog.fromViewController = self
inviteDialog.show()
}
}
func appInviteDialog(_ appInviteDialog: FBSDKAppInviteDialog!, didCompleteWithResults results: [AnyHashable : Any]!) {
if results != nil{
let resultObject = NSDictionary(dictionary: results)
if let didCancel = resultObject.value(forKey: “completionGesture”)
{
if (didCancel as AnyObject).caseInsensitiveCompare(“Cancel”) == ComparisonResult.orderedSame
{
print(“User Canceled invitation dialog”)
}
}
}
}
func appInviteDialog(_ appInviteDialog: FBSDKAppInviteDialog!, didFailWithError error: Error!) {
print(“Error tool place in appInviteDialog \(error)“)
}
然而,这仅显示了当其通过Wi-Fi并且当其在3G / LTE上无法工作时分享的朋友列表,并且对话窗口刚刚关闭并转到错误方法。有没有办法使它不仅在Wi-Fi上工作?或者这是Facebook的错误吗?
答案 0 :(得分:0)
我不认为它与wifi有什么关系。你应该买一部更好的手机。