我在下面的应用程序中添加了Facebook应用程序邀请功能,这是我发送应用程序邀请的代码
let content = FBSDKAppInviteContent()
content.appLinkURL = NSURL(string: "applinkurl")
content.appInvitePreviewImageURL = NSURL(string: "appInvitePreviewImageURL")
FBSDKAppInviteDialog.showWithContent(content, delegate: self);
我在班级下面添加了扩展名
extension FACEBOOKTEXT:FBSDKAppInviteDialogDelegate {
//MARK: FBSDKAppInviteDialogDelegate
func appInviteDialog(appInviteDialog: FBSDKAppInviteDialog!, didCompleteWithResults results: [NSObject : AnyObject]!) {
print("invitation made")
}
func appInviteDialog(appInviteDialog: FBSDKAppInviteDialog!, didFailWithError error: NSError!) {
print("error made")
}
在应用程序委托中:
func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject?) -> Bool {
var shouldReturn:Bool = FBSDKApplicationDelegate.sharedInstance().application(application, openURL: url, sourceApplication: sourceApplication, annotation: annotation);
shouldReturn = shouldReturn || GIDSignIn.sharedInstance().handleURL(url, sourceApplication: sourceApplication, annotation: annotation);
shouldReturn = shouldReturn || Instagram.sharedManager().handleOpenURL(url);
shouldReturn = shouldReturn || LinkedInBridge.handleURL(application, openURL: url, sourceApplication: sourceApplication, annotation: annotation);
return shouldReturn;
}
我已经从Facebook门户nd配置了“ App Links”,并将其放在infi.plist和content.appLinkURL中。
运行此代码后,将发送应用邀请。当应用程序邀请的接收者在android上时,邀请会在Facebook的通知提示中列出,并且可以通过它安装应用程序。但是,如果邀请的接收者在iOS上,则邀请未在使用的通知供稿中列出,但是如果用户转到facebook->更多(选项卡)->应用->应用邀请,则会在此处列出邀请。
请指导我哪里做错了。以及如何在iOS(如android)中列出通知中的邀请函。我正在使用Xcode 6.4和Swift 1.2,这适用于iOS 8但不适用于iOS 9
提前致谢,
在您的info.plist中添加以下URL方案以使其在iOS 9中工作
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbapi</string>
<string>fbapi20130214</string>
<string>fbapi20130410</string>
<string>fbapi20130702</string>
<string>fbapi20131010</string>
<string>fbapi20131219</string>
<string>fbapi20140410</string>
<string>fbapi20140116</string>
<string>fbapi20150313</string>
<string>fbapi20150629</string>
<string>fbapi20160328</string>
<string>fbauth</string>
<string>fbauth2</string>
<string>fb-messenger-api20140430</string>
<string>fb-messenger-platform-20150128</string>
<string>fb-messenger-platform-20150218</string>
<string>fb-messenger-platform-20150305</string>
<string>fb-messenger-api</string>
<string>fbshareextension</string>
</array>
此外,请执行以下两项操作:1.打开facebook.com->“设置”->“应用”->“删除”(如果已授予该应用的许可)
希望这对您有用。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句