0

While I think I've added and set up the FacebookMessengerSDK correctly I keep getting this error when I click the share button, which at the moment would just present the messenger, it doesn't actually do anything yet.

LaunchServices: ERROR: There is no registered handler for URL scheme fb-messenger-

Here is part of my Plist source code which the Facebook developer website told me to include.

<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>

Here is my app delegate

import UIKit import FBSDKCoreKit import 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

}


}

Any help? Thank you!

Echizzle
  • 3,359
  • 5
  • 17
  • 28
  • Are you missing the end of the error message? – rmaddy Feb 05 '16 at 21:20
  • No that was it, after that, it just said "platform" and some numbers after – Echizzle Feb 05 '16 at 22:01
  • The URL scheme is really `fb-messenger-` with the trailing hyphen? Sounds like a typo somewhere. – rmaddy Feb 05 '16 at 22:02
  • Here is the whole thing... LaunchServices: ERROR: There is no registered handler for URL scheme fb-messenger-platform-20150128 – Echizzle Feb 05 '16 at 22:18
  • That's better. The message simply means you do not have any app installed that can respond to the custom scheme. – rmaddy Feb 05 '16 at 22:19
  • Ah okay, thank you! That makes sense, but once the user is logged in, how would I go about sending a message to a friend via the messenger api? The docs are fairly lacking. – Echizzle Feb 05 '16 at 22:47

0 Answers0