集成Facebook messenger API时URL方案处理程序错误

时间:2016-02-05 21:17:39

标签: ios swift2 facebook-sdk-4.0 facebook-messenger

虽然我认为我已经正确地添加并设置了FacebookMes​​sengerSDK但是当我点击分享按钮时会一直收到此错误,此按钮此时只显示信使,它实际上并没有做任何事情

  

LaunchServices:错误:URL方案没有注册处理程序   FB-信使 -

以下是我的Plist源代码的一部分,Facebook开发者网站告诉我这些源代码包含在内。

<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleURLSchemes</key>
        <array>
            <string><RemovedForSecurityPurposes></string>
        </array>
    </dict>
</array>
<key>FacebookAppID</key>
<string><RemovedForSecurityPurposes></string>
<key>FacebookDisplayName</key>
<string><FBAppNameHere></string>
<key>NSAppTransportSecurity</key>
<dict>
    <key>NSExceptionDomains</key>
    <dict>
        <key>facebook.com</key>
        <dict>
            <key>NSIncludesSubdomains</key>
            <true/>
            <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
            <false/>
        </dict>
        <key>fbcdn.net</key>
        <dict>
            <key>NSIncludesSubdomains</key>
            <true/>
            <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
            <false/>
        </dict>
        <key>akamaihd.net</key>
        <dict>
            <key>NSIncludesSubdomains</key>
            <true/>
            <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
            <false/>
        </dict>
    </dict>
</dict>
<key>LSApplicationQueriesSchemes</key>
<array>
    <string>fbapi</string>
    <string>fb-messenger-api</string>
    <string>fbauth2</string>
    <string>fbshareextension</string>
</array>

这是我的app delegate

导入UIKit 导入FBSDKCoreKit 导入FBSDKMessengerShareKit

@UIApplicationMain class AppDelegate:UIResponder,UIApplicationDelegate,FBSDKMessengerURLHandlerDelegate {

var window: UIWindow?
var composerContext = FBSDKMessengerURLHandlerOpenFromComposerContext()
var replyContext = FBSDKMessengerURLHandlerReplyContext()


func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {

    FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions)

    let messengerURLHandler = FBSDKMessengerURLHandler()
    messengerURLHandler.delegate = self

    return true
}

//Other stuff was here but I removed it

func applicationDidBecomeActive(application: UIApplication) {

    FBSDKAppEvents.activateApp()
}

func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool {

    let urlHandler = FBSDKMessengerURLHandler()

    if urlHandler.canOpenURL(url, sourceApplication: sourceApplication) {

        urlHandler.openURL(url, sourceApplication: sourceApplication)
    }

    return FBSDKApplicationDelegate.sharedInstance().application(application, openURL: url, sourceApplication: sourceApplication, annotation: annotation)
}

//Messenger

func messengerURLHandler(messengerURLHandler: FBSDKMessengerURLHandler!, didHandleOpenFromComposerWithContext context: FBSDKMessengerURLHandlerOpenFromComposerContext!) {

    composerContext = context

}

func messengerURLHandler(messengerURLHandler: FBSDKMessengerURLHandler!, didHandleReplyWithContext context: FBSDKMessengerURLHandlerReplyContext!) {

    replyContext = context

}


}

有任何帮助吗?谢谢!

0 个答案:

没有答案