Reputation: 284
I am using Facebook Messenger SDK on iOS 9 but sharing will not work. Even if I have Facebook Messenger installed on my iPhone it acts like it wouldn't be there.
The following line will return 0: FBSDKMessengerSharer.messengerPlatformCapabilities()
I want to mention that everything worked correctly on iOS 8.
Upvotes: 1
Views: 2246
Reputation: 1610
If you use any of the Facebook dialogs (e.g., Login, Share, App Invites, etc.) that can perform an app switch to Facebook apps, you will need to update your application's plist to handle the changes to canOpenURLdescribed in https://developer.apple.com/videos/wwdc/2015/?id=703.
If you're recompiling with iOS SDK 9.0, add the following to your application's plist if you're using a version of the SDK v4.5 or older:
<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> </array>
If you're using FBSDKMessengerShareKit from versions older than the v4.6 release, also add
<string>fb-messenger-platform-20150128</string> <string>fb-messenger-platform-20150218</string> <string>fb-messenger-platform-20150305</string>
If you're using v4.6.0 or higher of the SDK, you only need to add:
<key>LSApplicationQueriesSchemes</key> <array> <string>fbapi</string> <string>fb-messenger-api</string> <string>fbauth2</string> <string>fbshareextension</string> </array>
This will allow the FacebookSDK integration to properly identify installed Facebook apps to perform an app switch. If you are not recompiling with iOS SDK 9.0, your app is limited to 50 distinct schemes (calls tocanOpenURL afterwards return NO).
Upvotes: 2
Reputation: 473
Please add these lines in your Appdelegate Class
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions)
return true
}
func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool {
return FBSDKApplicationDelegate.sharedInstance().application(application, openURL: url, sourceApplication: sourceApplication, annotation: annotation)
}
func applicationDidBecomeActive(application: UIApplication) {
FBSDKAppEvents.activateApp()
}
And make sure whether you have added these info .plist
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
Upvotes: 0
Reputation: 284
Answering my own question: Things with URL schemes have changed a little bit in iOS 9, you have to add Facebook Messenger's URL scheme in kind of a 'whitelist' for your app.
You can find more details here: iOS 9 not opening Instagram app with URL SCHEME
Upvotes: 1