lithium
lithium

Reputation: 1302

-canOpenURL: failed for URL error for facebook and other social networks

I have a problem with facebook and vk.com integration. When I'm trying to authorize a user all I get is

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

and

-canOpenURL: failed for URL: "vkauthorize://authorize" - error: "(null)"

in the console.

I already updated info.plist like that:

<dict>
    <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>fbauth</string>
        <string>fbauth2</string>
        <string>fb-messenger-api20140430</string>
        <string>fb-messenger-api</string>
        <string>fbshareextension</string>
        <string>twitter</string>
        <string>whatsapp</string>
        <string>wechat</string>
        <string>line</string>
        <string>instagram</string>
        <string>kakaotalk</string>
        <string>pinterest</string>
        <string>vk</string>
        <string>vkauthorize</string>
    </array>
....
    <key>NSAppTransportSecurity</key>
    <dict>
        <key>NSAllowsArbitraryLoads</key>
        <true/>
        <key>NSExceptionDomains</key>
        <dict>
            <key>facebook.com</key>
            <dict>
                <key>NSIncludesSubdomains</key>
                <true/>
                <key>NSExceptionRequiresForwardSecrecy</key>
                <false/>
            </dict>
            <key>fbcdn.net</key>
            <dict>
                <key>NSIncludesSubdomains</key>
                <true/>
                <key>NSExceptionRequiresForwardSecrecy</key>
                <false/>
            </dict>
            <key>akamaihd.net</key>
            <dict>
                <key>NSIncludesSubdomains</key>
                <true/>
                <key>NSExceptionRequiresForwardSecrecy</key>
                <false/>
            </dict>
        </dict>
    </dict>

but it still don't work on device/simulator. What did I miss?

I'm using Facebook SDK 4.6

P.S. tried Facebook SDK 4.7.0

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

Upvotes: 0

Views: 3884

Answers (2)

user12688502
user12688502

Reputation:

I know this is old question but I had the same error so replacing pod

pod 'FacebookCore'

pod 'FacebookLogin'

with

pod 'FBSDKCoreKit', '~> 4.38.0'

pod 'FBSDKLoginKit', '~> 4.38.0'

solved my problem. Might be helpful to someone.

Upvotes: 0

lithium
lithium

Reputation: 1302

So, I found the source of all the troubles in my case.

There were incredible mistakes in my plist.info.

  1. In URL schemes fb app id was like "fb(nnnnnnn)" (the right format is "fbnnnnnnn").

  2. in FacebookAppId my app id was like "{nnnnnnn}" (the right format is "nnnnnn").

I don't think these mistakes were made by me, but I can't be sure here.

Upvotes: 1

Related Questions