canOpenURL fails on iOS 13

On iOS 13 it looks like openURL is failing for at least facebook.


I have tried a very simple test app to verify , and it always fails with :


2019-06-08 17:31:03.687369-0700 TestFacebook[48641:2771343] -canOpenURL: failed for URL: "fbauth2:/" - error: "The operation couldn’t be completed. (OSStatus error -10814.)"

It will fail on both simulator and device.


If the auth was already present reading the auth from SDK continues to work. Anyone else seeing this behavior or know of a workaround?

Post not yet marked as solved Up vote post of grangej Down vote post of grangej
1.0.0k views

Replies

It's not new in iOS 13, but have you checked the LSApplicationQueriesSchemes in your Info.plist? For quite a long time (iOS 10 or 11?) you have to explicitly declare which URL schemes you will query. Some apps (cough, Twitter, cough) were abusing it find what other apps you had installed. This is why we can't have nice things...

Yes these are all set in the info.plist , this all works 100% when run against iOS 12 device or simulator but runnin on a device or similator running iOS 13 will fail with the above mentioned error.


Still happening as of beta 2

To be clear this happens even when creating a very simple test application using the latest facebook SDK and correctly updating plist etc.

Did you resolve this issue? I am having the same problem after upgrading to Xcode 11 and iOS 13.

If you are creating Project using Xcode 11, you need to handle opening URL in this method of SceneDelegate.swift:


func scene(_ scene: UIScene, openURLContexts URLContexts: Set)

instead of usual place in AppDelegate.swift:

func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool

Or you can get rid of the UISceneConfiguration and use the old approach.