Search code examples
iosswiftswift2facebook-ios-sdkios9

'Open this page in "null"' Modal appearing from FacebookSDK login after iOS9 and Swift 2 upgrade


I'm in the process of updating projects to Swift 2 and iOS 9. One of the projects I'm doing relies heavily on Facebooks SDK. I use it to login, get user information, ect... Prior ot the update, once you logged in the Safari would redirect you directly to the app. Now I'm getting a fun little modal displaying the following (See Fig 1 at bottom)

I assume this has some connection to the new Info.plist key we add LSApplicationQueriesSchemes with a Item0 as fbauth2 now required by iOS 9.

I also noticed I'm getting a stack trace with my app saying:

failed for URL: "fbauth2:///" - error: "(null)"

I found the reoccurence of the new key data fbauth2 interesting, and I'm assuming that there is now a way to configure what this modal will say upon redirect. Does anyone have any idea how to configure this? I'm assuming this is a common issue for all those updating their apps. Thanks!

Fig 1 enter image description here


Solution

  • Make sure that you have updated to the newest version of the Facebook SDK at http://fb.me/FacebookSDKs-iOS-20150910.zip.

    You will also want to Whitelist the Facebook Servers for Network Requests. More information on this can be found here.

    Specifically look at steps #2 & #3.

    From the documentation in Step #3 there were also changes to the canOpenURL method:

    Why do I see console messages like 'canOpenURL: failed for URL: "fb...://' or ? This is an Xcode warning indicating the the canOpenURL: call returned false. As long as you have configured the LSApplicationQueriesSchemes entry in your plist as described above, you can ignore this warning