facebook login issue - canOpenURL: failed for URL: “fbauth2:///” - error: “(null)”





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







57















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.4



I 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?










share|improve this question

























  • Any update on this? I'm in the same boat, have all they keys defined and my users cannot login to Facebook unless it is the native iOS dialog. Web view and app switch both fail.

    – Andrew
    Sep 26 '15 at 18:12











  • Any luck here? My Share Dialog is messing up :(

    – Mohsin Khubaib Ahmed
    Oct 28 '15 at 12:01











  • Can you share your code on the git and i will check it.

    – sfbayman
    Oct 29 '15 at 13:06











  • I was stuck on the same issue and this answer saved me

    – wynnset
    Nov 12 '15 at 6:35


















57















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.4



I 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?










share|improve this question

























  • Any update on this? I'm in the same boat, have all they keys defined and my users cannot login to Facebook unless it is the native iOS dialog. Web view and app switch both fail.

    – Andrew
    Sep 26 '15 at 18:12











  • Any luck here? My Share Dialog is messing up :(

    – Mohsin Khubaib Ahmed
    Oct 28 '15 at 12:01











  • Can you share your code on the git and i will check it.

    – sfbayman
    Oct 29 '15 at 13:06











  • I was stuck on the same issue and this answer saved me

    – wynnset
    Nov 12 '15 at 6:35














57












57








57


7






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.4



I 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?










share|improve this question
















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.4



I 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?







ios facebook swift facebook-graph-api parse-platform






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Apr 6 '18 at 0:28









Matias Jurfest

450616




450616










asked Sep 19 '15 at 2:02









sfbaymansfbayman

5571619




5571619













  • Any update on this? I'm in the same boat, have all they keys defined and my users cannot login to Facebook unless it is the native iOS dialog. Web view and app switch both fail.

    – Andrew
    Sep 26 '15 at 18:12











  • Any luck here? My Share Dialog is messing up :(

    – Mohsin Khubaib Ahmed
    Oct 28 '15 at 12:01











  • Can you share your code on the git and i will check it.

    – sfbayman
    Oct 29 '15 at 13:06











  • I was stuck on the same issue and this answer saved me

    – wynnset
    Nov 12 '15 at 6:35



















  • Any update on this? I'm in the same boat, have all they keys defined and my users cannot login to Facebook unless it is the native iOS dialog. Web view and app switch both fail.

    – Andrew
    Sep 26 '15 at 18:12











  • Any luck here? My Share Dialog is messing up :(

    – Mohsin Khubaib Ahmed
    Oct 28 '15 at 12:01











  • Can you share your code on the git and i will check it.

    – sfbayman
    Oct 29 '15 at 13:06











  • I was stuck on the same issue and this answer saved me

    – wynnset
    Nov 12 '15 at 6:35

















Any update on this? I'm in the same boat, have all they keys defined and my users cannot login to Facebook unless it is the native iOS dialog. Web view and app switch both fail.

– Andrew
Sep 26 '15 at 18:12





Any update on this? I'm in the same boat, have all they keys defined and my users cannot login to Facebook unless it is the native iOS dialog. Web view and app switch both fail.

– Andrew
Sep 26 '15 at 18:12













Any luck here? My Share Dialog is messing up :(

– Mohsin Khubaib Ahmed
Oct 28 '15 at 12:01





Any luck here? My Share Dialog is messing up :(

– Mohsin Khubaib Ahmed
Oct 28 '15 at 12:01













Can you share your code on the git and i will check it.

– sfbayman
Oct 29 '15 at 13:06





Can you share your code on the git and i will check it.

– sfbayman
Oct 29 '15 at 13:06













I was stuck on the same issue and this answer saved me

– wynnset
Nov 12 '15 at 6:35





I was stuck on the same issue and this answer saved me

– wynnset
Nov 12 '15 at 6:35












9 Answers
9






active

oldest

votes


















41














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






share|improve this answer



















  • 2





    This is the right answer. Thank you

    – AJ.
    Mar 21 '16 at 13:15





















33














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.






share|improve this answer































    4














    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())")





    share|improve this answer































      2














      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






      share|improve this answer


























      • I can ignore the warning but Facebook's view controller does not show up.

        – CQM
        Oct 21 '15 at 15:33











      • Did you import all required packages?

        – sfbayman
        Oct 26 '15 at 13:34



















      1















      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)
      }





      share|improve this answer































        0














        You have an extra "/" in your url "fbauth2:///".



        Then you can see "error_message=Invalid+Scope" in the url, you should probably check the permissions of your app:
        https://developers.facebook.com/docs/facebook-login/permissions/v2.4






        share|improve this answer
























        • I 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
          Sep 19 '15 at 5:00













        • MY 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

          – sfbayman
          Sep 19 '15 at 15:33





















        0














        The issue is due to App Transport Security introduced in iOS 9.



        There are two solutions, both deal with fixing your info.plist file



        Here's a guide http://discoverpioneer.com/blog/2015/09/18/updating-facebook-integration-for-ios-9/






        share|improve this answer































          0














          You need to add this method if your app is running on iOS9 or above.



          - (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString*, id> *)options {
          return [[FBSDKApplicationDelegate sharedInstance] application:app
          openURL:url
          sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey]
          annotation:options[UIApplicationOpenURLOptionsAnnotationKey]];


          }



          In case you need a Swift version:



          @available(iOS 9.0, *)
          func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
          return SDKApplicationDelegate.shared.application(app,
          open: url,
          sourceApplication: options[UIApplicationOpenURLOptionsKey.sourceApplication] as? String,
          annotation: options[UIApplicationOpenURLOptionsKey.annotation] as Any)
          }





          share|improve this answer

































            0














            I figured out my issue. It was just the syntax in loginButtonClicked function. The error message was leading me down the wrong path. Here is the working code.



            @objc func loginButtonClicked() {
            self.login = FBSDKLoginManager()

            self.login.logIn(withReadPermissions: ["public_profile"], from: self, handler: {(result, error) -> Void in
            if error != nil {
            print("Process error")
            }
            else if (result?.isCancelled)! {
            print("Cancelled")
            }
            else {
            print("Logged in")
            DispatchQueue.main.async(execute: {
            let viewController:UIViewController = self.storyboard?.instantiateViewController(withIdentifier: "UITabBarController") as! UITabBarController
            self.present(viewController, animated: true, completion: nil)
            })
            }

            })
            }





            share|improve this answer






















              protected by Community Apr 6 '16 at 11:34



              Thank you for your interest in this question.
              Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).



              Would you like to answer one of these unanswered questions instead?














              9 Answers
              9






              active

              oldest

              votes








              9 Answers
              9






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              41














              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






              share|improve this answer



















              • 2





                This is the right answer. Thank you

                – AJ.
                Mar 21 '16 at 13:15


















              41














              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






              share|improve this answer



















              • 2





                This is the right answer. Thank you

                – AJ.
                Mar 21 '16 at 13:15
















              41












              41








              41







              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






              share|improve this answer













              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







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Nov 12 '15 at 12:04









              EdoBenEdoBen

              5181619




              5181619








              • 2





                This is the right answer. Thank you

                – AJ.
                Mar 21 '16 at 13:15
















              • 2





                This is the right answer. Thank you

                – AJ.
                Mar 21 '16 at 13:15










              2




              2





              This is the right answer. Thank you

              – AJ.
              Mar 21 '16 at 13:15







              This is the right answer. Thank you

              – AJ.
              Mar 21 '16 at 13:15















              33














              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.






              share|improve this answer




























                33














                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.






                share|improve this answer


























                  33












                  33








                  33







                  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.






                  share|improve this answer













                  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.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Mar 29 '16 at 16:35









                  Chris PanChris Pan

                  1,8431116




                  1,8431116























                      4














                      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())")





                      share|improve this answer




























                        4














                        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())")





                        share|improve this answer


























                          4












                          4








                          4







                          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())")





                          share|improve this answer













                          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())")






                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Nov 20 '15 at 17:16









                          Himanshu MahajanHimanshu Mahajan

                          3,67122429




                          3,67122429























                              2














                              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






                              share|improve this answer


























                              • I can ignore the warning but Facebook's view controller does not show up.

                                – CQM
                                Oct 21 '15 at 15:33











                              • Did you import all required packages?

                                – sfbayman
                                Oct 26 '15 at 13:34
















                              2














                              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






                              share|improve this answer


























                              • I can ignore the warning but Facebook's view controller does not show up.

                                – CQM
                                Oct 21 '15 at 15:33











                              • Did you import all required packages?

                                – sfbayman
                                Oct 26 '15 at 13:34














                              2












                              2








                              2







                              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






                              share|improve this answer















                              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







                              share|improve this answer














                              share|improve this answer



                              share|improve this answer








                              edited May 23 '17 at 12:26









                              Community

                              11




                              11










                              answered Sep 22 '15 at 3:24









                              sfbaymansfbayman

                              5571619




                              5571619













                              • I can ignore the warning but Facebook's view controller does not show up.

                                – CQM
                                Oct 21 '15 at 15:33











                              • Did you import all required packages?

                                – sfbayman
                                Oct 26 '15 at 13:34



















                              • I can ignore the warning but Facebook's view controller does not show up.

                                – CQM
                                Oct 21 '15 at 15:33











                              • Did you import all required packages?

                                – sfbayman
                                Oct 26 '15 at 13:34

















                              I can ignore the warning but Facebook's view controller does not show up.

                              – CQM
                              Oct 21 '15 at 15:33





                              I can ignore the warning but Facebook's view controller does not show up.

                              – CQM
                              Oct 21 '15 at 15:33













                              Did you import all required packages?

                              – sfbayman
                              Oct 26 '15 at 13:34





                              Did you import all required packages?

                              – sfbayman
                              Oct 26 '15 at 13:34











                              1















                              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)
                              }





                              share|improve this answer




























                                1















                                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)
                                }





                                share|improve this answer


























                                  1












                                  1








                                  1








                                  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)
                                  }





                                  share|improve this 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.




                                  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)
                                  }






                                  share|improve this answer












                                  share|improve this answer



                                  share|improve this answer










                                  answered Sep 13 '17 at 18:01









                                  ZAFAR007ZAFAR007

                                  1,00711326




                                  1,00711326























                                      0














                                      You have an extra "/" in your url "fbauth2:///".



                                      Then you can see "error_message=Invalid+Scope" in the url, you should probably check the permissions of your app:
                                      https://developers.facebook.com/docs/facebook-login/permissions/v2.4






                                      share|improve this answer
























                                      • I 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
                                        Sep 19 '15 at 5:00













                                      • MY 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

                                        – sfbayman
                                        Sep 19 '15 at 15:33


















                                      0














                                      You have an extra "/" in your url "fbauth2:///".



                                      Then you can see "error_message=Invalid+Scope" in the url, you should probably check the permissions of your app:
                                      https://developers.facebook.com/docs/facebook-login/permissions/v2.4






                                      share|improve this answer
























                                      • I 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
                                        Sep 19 '15 at 5:00













                                      • MY 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

                                        – sfbayman
                                        Sep 19 '15 at 15:33
















                                      0












                                      0








                                      0







                                      You have an extra "/" in your url "fbauth2:///".



                                      Then you can see "error_message=Invalid+Scope" in the url, you should probably check the permissions of your app:
                                      https://developers.facebook.com/docs/facebook-login/permissions/v2.4






                                      share|improve this answer













                                      You have an extra "/" in your url "fbauth2:///".



                                      Then you can see "error_message=Invalid+Scope" in the url, you should probably check the permissions of your app:
                                      https://developers.facebook.com/docs/facebook-login/permissions/v2.4







                                      share|improve this answer












                                      share|improve this answer



                                      share|improve this answer










                                      answered Sep 19 '15 at 4:51









                                      Paul SlmPaul Slm

                                      20327




                                      20327













                                      • I 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
                                        Sep 19 '15 at 5:00













                                      • MY 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

                                        – sfbayman
                                        Sep 19 '15 at 15:33





















                                      • I 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
                                        Sep 19 '15 at 5:00













                                      • MY 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

                                        – sfbayman
                                        Sep 19 '15 at 15:33



















                                      I 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
                                      Sep 19 '15 at 5:00







                                      I 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
                                      Sep 19 '15 at 5:00















                                      MY 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

                                      – sfbayman
                                      Sep 19 '15 at 15:33







                                      MY 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

                                      – sfbayman
                                      Sep 19 '15 at 15:33













                                      0














                                      The issue is due to App Transport Security introduced in iOS 9.



                                      There are two solutions, both deal with fixing your info.plist file



                                      Here's a guide http://discoverpioneer.com/blog/2015/09/18/updating-facebook-integration-for-ios-9/






                                      share|improve this answer




























                                        0














                                        The issue is due to App Transport Security introduced in iOS 9.



                                        There are two solutions, both deal with fixing your info.plist file



                                        Here's a guide http://discoverpioneer.com/blog/2015/09/18/updating-facebook-integration-for-ios-9/






                                        share|improve this answer


























                                          0












                                          0








                                          0







                                          The issue is due to App Transport Security introduced in iOS 9.



                                          There are two solutions, both deal with fixing your info.plist file



                                          Here's a guide http://discoverpioneer.com/blog/2015/09/18/updating-facebook-integration-for-ios-9/






                                          share|improve this answer













                                          The issue is due to App Transport Security introduced in iOS 9.



                                          There are two solutions, both deal with fixing your info.plist file



                                          Here's a guide http://discoverpioneer.com/blog/2015/09/18/updating-facebook-integration-for-ios-9/







                                          share|improve this answer












                                          share|improve this answer



                                          share|improve this answer










                                          answered Sep 19 '15 at 16:40









                                          PhilPhil

                                          5171616




                                          5171616























                                              0














                                              You need to add this method if your app is running on iOS9 or above.



                                              - (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString*, id> *)options {
                                              return [[FBSDKApplicationDelegate sharedInstance] application:app
                                              openURL:url
                                              sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey]
                                              annotation:options[UIApplicationOpenURLOptionsAnnotationKey]];


                                              }



                                              In case you need a Swift version:



                                              @available(iOS 9.0, *)
                                              func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
                                              return SDKApplicationDelegate.shared.application(app,
                                              open: url,
                                              sourceApplication: options[UIApplicationOpenURLOptionsKey.sourceApplication] as? String,
                                              annotation: options[UIApplicationOpenURLOptionsKey.annotation] as Any)
                                              }





                                              share|improve this answer






























                                                0














                                                You need to add this method if your app is running on iOS9 or above.



                                                - (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString*, id> *)options {
                                                return [[FBSDKApplicationDelegate sharedInstance] application:app
                                                openURL:url
                                                sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey]
                                                annotation:options[UIApplicationOpenURLOptionsAnnotationKey]];


                                                }



                                                In case you need a Swift version:



                                                @available(iOS 9.0, *)
                                                func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
                                                return SDKApplicationDelegate.shared.application(app,
                                                open: url,
                                                sourceApplication: options[UIApplicationOpenURLOptionsKey.sourceApplication] as? String,
                                                annotation: options[UIApplicationOpenURLOptionsKey.annotation] as Any)
                                                }





                                                share|improve this answer




























                                                  0












                                                  0








                                                  0







                                                  You need to add this method if your app is running on iOS9 or above.



                                                  - (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString*, id> *)options {
                                                  return [[FBSDKApplicationDelegate sharedInstance] application:app
                                                  openURL:url
                                                  sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey]
                                                  annotation:options[UIApplicationOpenURLOptionsAnnotationKey]];


                                                  }



                                                  In case you need a Swift version:



                                                  @available(iOS 9.0, *)
                                                  func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
                                                  return SDKApplicationDelegate.shared.application(app,
                                                  open: url,
                                                  sourceApplication: options[UIApplicationOpenURLOptionsKey.sourceApplication] as? String,
                                                  annotation: options[UIApplicationOpenURLOptionsKey.annotation] as Any)
                                                  }





                                                  share|improve this answer















                                                  You need to add this method if your app is running on iOS9 or above.



                                                  - (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString*, id> *)options {
                                                  return [[FBSDKApplicationDelegate sharedInstance] application:app
                                                  openURL:url
                                                  sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey]
                                                  annotation:options[UIApplicationOpenURLOptionsAnnotationKey]];


                                                  }



                                                  In case you need a Swift version:



                                                  @available(iOS 9.0, *)
                                                  func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
                                                  return SDKApplicationDelegate.shared.application(app,
                                                  open: url,
                                                  sourceApplication: options[UIApplicationOpenURLOptionsKey.sourceApplication] as? String,
                                                  annotation: options[UIApplicationOpenURLOptionsKey.annotation] as Any)
                                                  }






                                                  share|improve this answer














                                                  share|improve this answer



                                                  share|improve this answer








                                                  edited Sep 13 '17 at 16:17









                                                  Gabriel Lidenor

                                                  1,84721525




                                                  1,84721525










                                                  answered Apr 20 '17 at 9:16









                                                  MuzammilMuzammil

                                                  1,0171120




                                                  1,0171120























                                                      0














                                                      I figured out my issue. It was just the syntax in loginButtonClicked function. The error message was leading me down the wrong path. Here is the working code.



                                                      @objc func loginButtonClicked() {
                                                      self.login = FBSDKLoginManager()

                                                      self.login.logIn(withReadPermissions: ["public_profile"], from: self, handler: {(result, error) -> Void in
                                                      if error != nil {
                                                      print("Process error")
                                                      }
                                                      else if (result?.isCancelled)! {
                                                      print("Cancelled")
                                                      }
                                                      else {
                                                      print("Logged in")
                                                      DispatchQueue.main.async(execute: {
                                                      let viewController:UIViewController = self.storyboard?.instantiateViewController(withIdentifier: "UITabBarController") as! UITabBarController
                                                      self.present(viewController, animated: true, completion: nil)
                                                      })
                                                      }

                                                      })
                                                      }





                                                      share|improve this answer




























                                                        0














                                                        I figured out my issue. It was just the syntax in loginButtonClicked function. The error message was leading me down the wrong path. Here is the working code.



                                                        @objc func loginButtonClicked() {
                                                        self.login = FBSDKLoginManager()

                                                        self.login.logIn(withReadPermissions: ["public_profile"], from: self, handler: {(result, error) -> Void in
                                                        if error != nil {
                                                        print("Process error")
                                                        }
                                                        else if (result?.isCancelled)! {
                                                        print("Cancelled")
                                                        }
                                                        else {
                                                        print("Logged in")
                                                        DispatchQueue.main.async(execute: {
                                                        let viewController:UIViewController = self.storyboard?.instantiateViewController(withIdentifier: "UITabBarController") as! UITabBarController
                                                        self.present(viewController, animated: true, completion: nil)
                                                        })
                                                        }

                                                        })
                                                        }





                                                        share|improve this answer


























                                                          0












                                                          0








                                                          0







                                                          I figured out my issue. It was just the syntax in loginButtonClicked function. The error message was leading me down the wrong path. Here is the working code.



                                                          @objc func loginButtonClicked() {
                                                          self.login = FBSDKLoginManager()

                                                          self.login.logIn(withReadPermissions: ["public_profile"], from: self, handler: {(result, error) -> Void in
                                                          if error != nil {
                                                          print("Process error")
                                                          }
                                                          else if (result?.isCancelled)! {
                                                          print("Cancelled")
                                                          }
                                                          else {
                                                          print("Logged in")
                                                          DispatchQueue.main.async(execute: {
                                                          let viewController:UIViewController = self.storyboard?.instantiateViewController(withIdentifier: "UITabBarController") as! UITabBarController
                                                          self.present(viewController, animated: true, completion: nil)
                                                          })
                                                          }

                                                          })
                                                          }





                                                          share|improve this answer













                                                          I figured out my issue. It was just the syntax in loginButtonClicked function. The error message was leading me down the wrong path. Here is the working code.



                                                          @objc func loginButtonClicked() {
                                                          self.login = FBSDKLoginManager()

                                                          self.login.logIn(withReadPermissions: ["public_profile"], from: self, handler: {(result, error) -> Void in
                                                          if error != nil {
                                                          print("Process error")
                                                          }
                                                          else if (result?.isCancelled)! {
                                                          print("Cancelled")
                                                          }
                                                          else {
                                                          print("Logged in")
                                                          DispatchQueue.main.async(execute: {
                                                          let viewController:UIViewController = self.storyboard?.instantiateViewController(withIdentifier: "UITabBarController") as! UITabBarController
                                                          self.present(viewController, animated: true, completion: nil)
                                                          })
                                                          }

                                                          })
                                                          }






                                                          share|improve this answer












                                                          share|improve this answer



                                                          share|improve this answer










                                                          answered Nov 12 '17 at 13:52









                                                          Rob SchlackmanRob Schlackman

                                                          15416




                                                          15416

















                                                              protected by Community Apr 6 '16 at 11:34



                                                              Thank you for your interest in this question.
                                                              Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).



                                                              Would you like to answer one of these unanswered questions instead?



                                                              Popular posts from this blog

                                                              MongoDB - Not Authorized To Execute Command

                                                              How to fix TextFormField cause rebuild widget in Flutter

                                                              in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith