147
votes
FBSDKLog: fbauth2 is missing from your Info.plist under LSApplicationQueriesSchemes and is required for iOS 9.0

Any idea what this is? I have added it in my plist but did not work.

9

9 Answers

348
votes

You can continue to use URL schemes when you build your app for iOS 9 and you want to call URL schemes, you will now need to declare them in your apps Info.plist. There is a new key, LSApplicationQueriesSchemes, and here you will need to add the list of schemes you want to are canOpenURL on.

Try like this.

<key>LSApplicationQueriesSchemes</key>
<array>
    <string>fbauth2</string>
</array>
25
votes

If you are using iOS9 then this is important to update your info.plist file. You just need to do 3 steps 1. Go to info.plist 2. Add a field namely LSApplicationQueriesSchemes NSArray datatype. 3. Add an item of NSString datatype name it as fbauth2.

Thats it. Just clean and run. warning wont show again.enter image description here

21
votes

As to v4.6.0 of the FaceBook SDK, add the following key into your plist file:

<key>LSApplicationQueriesSchemes</key>
<array>
        <string>fbapi</string>
        <string>fb-messenger-api</string>
        <string>fbauth2</string>
        <string>fbshareextension</string>
</array>

Link: https://developers.facebook.com/docs/ios/ios9

14
votes

Just follow the Facebook explanation: Preparing Your Apps for iOS9
Apple mention it in their:Privacy and Your App Keynote 2015

5
votes

Please just do not add this to your CFBundleURLSchemes... that will actually HIJACK any app's attempt at Facebook auth, causing a popup to show "X app wants to open " dialog...

You DO NOT want to be doing that.

cf:

https://developers.facebook.com/docs/applinks/ios
https://www.fireeye.com/blog/threat-research/2015/04/url_masques_on_apps.html
https://www.reddit.com/r/workflow/comments/2tlx29/get_url_scheme_of_any_app
2
votes

I got this when running my Kiwi tests as our test target didn't have access to main bundle. So I had to add a condition to isRegisteredCanOpenURLScheme in FBSDKInternalUtility.m

+ (BOOL)isRegisteredCanOpenURLScheme:(NSString *)urlScheme
{
  static dispatch_once_t fetchBundleOnce;
  static NSArray *schemes = nil;

  dispatch_once(&fetchBundleOnce, ^{
    schemes = [[[NSBundle mainBundle] infoDictionary] valueForKey:@"LSApplicationQueriesSchemes"];
    if (!schemes) { // This is a work around for our Kiwi tests as the Specs target doesn't have access to main bundle
      NSBundle *bundle = [NSBundle bundleForClass:[self class]];
      NSString *path = [bundle pathForResource:@"Info" ofType:@"plist"];
      NSDictionary *dictionary = [NSDictionary dictionaryWithContentsOfFile:path];
      schemes = [dictionary valueForKey:@"LSApplicationQueriesSchemes"];
    }
  });

  return [schemes containsObject:urlScheme];
}
1
votes

To build your app for iOS 9 : ( For Facebook Share )

  1. Open Info.plist file , add another field LSApplicationQueriesSchemes under Information Property List and set it's datatype Array or NSArray .
  2. Add 3 items for LSApplicationQueriesSchemes and set their datatype to String or NSString .
  3. Assign fbauth2 , fbshareextension , fbapi as item value .

Follow this photo :

enter image description here

0
votes
Write the below code in your info.plist under the **LSApplicationQueriesScheme**

<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-platform-20150128</string>
        <string>fb-messenger-platform-20150218</string>
        <string>fb-messenger-platform-20150305</string>
0
votes

You can try with below code in swift 5.0

extension Bundle {
   static let externalURLSchemes: [String] = {
      guard let urlTypes = main.infoDictionary?["LSApplicationQueriesSchemes"] 
       as? [String] else {
        return []
      }
      return urlTypes
   }()
}

You can call using Bundle

guard Bundle.externalURLSchemes.contains(URLScheme) else {
    return
}