facebook login issue - canOpenURL: failed for URL: "fbauth2:///" - error: "(null)"
Solution 1
I have the same warning, but in Facebook Docs there is an answer.
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
https://developers.facebook.com/docs/ios/ios9
Solution 2
The "-canOpenURL: failed for URL" warning is a red herring and simply means the FB app is not installed on the device/simulator you're running on.
It looks like you're requesting an invalid scope (aka permission) of "Public". Can you include your code that includes what permissions you are asking? public_profile is probably what you want (and what the SDK defaults to if none are provided).
More importantly, do NOT add fbauth2 to your CFBundleURLSchemes as that will break login flows. As Himanshu pointed out, those entries should be entered under LSApplicationQueriesSchemes in our plist.
Solution 3
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 Facebook SDK v4.6.0 or above:
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbapi</string>
<string>fb-messenger-api</string>
<string>fbauth2</string>
<string>fbshareextension</string>
</array>
To prepare the facebook integration supported to iOS 9, go through Facebook Integraion for iOS 9 guidelines
To check version of facebook SDK, use below line of code:
print("SDK version \(FBSDKSettings .sdkVersion())")
Solution 4
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.
Go to this Link Select Your App, And configure your info.plist
import
And add this code in your AppDelegate
import FBSDKCoreKit .
import FBSDKLoginKit
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
return FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions)
}
func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
return FBSDKApplicationDelegate.sharedInstance().application(app, open: url, options: options)
}
Solution 5
I have missed the importing FBSDKCoreKit
. Later it started working on the simulator but not on the iPhone device.
Also noticed the following FAQ on the Facebook site. Why do I see console messages like
'canOpenURL: failed for URL: "fb...://'
or ? This is a Xcode warning indicating 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
Regarding not working on the iPhone device, please refer: Parse API - Facebook login not working on the iPhone device
sfbayman
Updated on April 06, 2020Comments
-
sfbayman about 4 years
When I click on login with Facebook button, it is opening safari browser and getting closed immediately. Noticed error on the console.
App delegate method:
func application(app: UIApplication, openURL url: NSURL, options: [String : AnyObject]) -> Bool { print("###### URL : ") print(url) print("###### App : ") print(app) print(options["UIApplicationOpenURLOptionsSourceApplicationKey"]) return FBSDKApplicationDelegate.sharedInstance().application(app, openURL: url, sourceApplication: options["UIApplicationOpenURLOptionsSourceApplicationKey"] as! String, annotation: nil) }
2015-09-18 18:37:51.410 [21036:5050465] -canOpenURL: failed for URL: "fbauth2:///" - error: "(null)" 2015-09-18 18:37:51.417[21036:5050465] -canOpenURL: failed for URL: "fbauth2:///" - error: "(null)" ###### URL : fb4554284912963222://authorize/?error_code=100&error_message=Invalid+Scope%3A+public&state=%7B%22challenge%22%3A%222ZmK6R5F05d%252F060TkCqj8SjPLjc%253D%22%2C%220_auth_logger_id%22%3A%223C79F2C8-61B9-470E-AE1B-E1C68435DB83%22%2C%22com.facebook.sdk_client_state%22%3Atrue%2C%223_method%22%3A%22sfvc_auth%22%7D&e2e=%7B%22init%22%3A145973.000512302%7D#_=_ ###### App : Optional(com.apple.SafariViewService) nil ###### err: Optional(Error Domain=com.facebook.sdk.core Code=8 "(null)" UserInfo={com.facebook.sdk:FBSDKGraphRequestErrorGraphErrorCode=100, com.facebook.sdk:FBSDKErrorDeveloperMessageKey=Invalid Scope: public, com.facebook.sdk:FBSDKGraphRequestErrorCategoryKey=0})
IDE : xcode 7
Language : Swift2
Facebook SDK : 4.6.0
Parse: 1.8.4I have also verified .plist is having all keys which are required. Also verified the bundle identifier for typo mistakes. All look good. Facebook is active.
Any help?
-
sfbayman over 8 yearsI did not use any URL. Any specific URL you are talking about? I have just used <key>LSApplicationQueriesSchemes</key> <array> <string>fbauth2</string> </array> in .plist file.
-
sfbayman over 8 yearsMY bad. I have missed the importing FBSDKCoreKit. Later it started working on the simulator but not on the iPhone device. Also noticed the following FAQ on the Facebook site. 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
-
CQM over 8 yearsI can ignore the warning but Facebook's view controller does not show up.
-
sfbayman over 8 yearsDid you import all required packages?
-
TylerJames over 4 yearsMy god the documentation for this is an absolute disaster. And I thought I couldn't like Facebook any less.
-
Krishna Karki over 2 yearsThis page is not active anymore. Can you post the solution please?