Info.plist 中缺少 iOS 9 “fbauth2”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/32006033/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 07:15:32  来源:igfitidea点击:

iOS 9 “fbauth2” missing from Info.plist

iosobjective-c

提问by nikhila

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.

知道这是什么吗?我已将它添加到我的 plist 中,但没有用。

回答by Kaey

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.

当您为 iOS 9 构建应用程序并且想要调用 URL 方案时,您可以继续使用 URL 方案,您现在需要在您的应用程序 Info.plist 中声明它们。有一个新键,LSApplicationQueriesSchemes,在这里您需要添加您想要在 canOpenURL 上的方案列表。

Try like this.

像这样尝试。

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

回答by M Swapnil

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 LSApplicationQueriesSchemesNSArray datatype. 3. Add an item of NSString datatype name it as fbauth2.

如果您使用的是 iOS9,那么更新您的 info.plist 文件很重要。您只需要执行 3 个步骤 1. 转到 info.plist 2. 添加一个字段,即LSApplicationQueriesSchemesNSArray 数据类型。3. 添加一个 NSString 数据类型的项目,将其命名为 fbauth2。

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

就是这样。只需清洁并运行即可。警告不会再次显示。在此处输入图片说明

回答by Yizhar

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

对于 FaceBook SDK v4.6.0,在你的 plist 文件中添加如下key:

<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

链接:https: //developers.facebook.com/docs/ios/ios9

回答by Mike.R

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

只需按照 Facebook 的解释:为 iOS9 准备您的应用程序
Apple 在他们的:Privacy and Your App Keynote 2015 中提到它

回答by user107172

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

请不要将其添加到您的 CFBundleURLSchemes 中...这实际上会劫持任何应用程序对 Facebook 身份验证的尝试,导致弹出窗口显示“X 应用程序想要打开”对话框...

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

回答by MdaG

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 isRegisteredCanOpenURLSchemein FBSDKInternalUtility.m

我在运行 Kiwi 测试时遇到了这个问题,因为我们的测试目标无法访问主包。所以我不得不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];
}

回答by roy

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

为 iOS 9 构建您的应用程序:(用于 Facebook 共享)

  1. Open Info.plistfile , add another field LSApplicationQueriesSchemesunder Information Property Listand set it's datatype Arrayor NSArray.
  2. Add 3 itemsfor LSApplicationQueriesSchemesand set their datatype to Stringor NSString.
  3. Assign fbauth2, fbshareextension, fbapias item value .
  1. 打开Info.plist文件,在信息属性列表下添加另一个字段 LSApplicationQueriesSchemes并设置它的数据类型或.ArrayNSArray
  2. LSApplicationQueriesSchemes添加 3 个项目并将它们的数据类型设置为或。StringNSString
  3. 分配fbauth2, fbshareextension,fbapi作为项目值。

Follow this photo:

跟随这张照片

enter image description here

在此处输入图片说明

回答by Sivabalaa Jothibose

You can try with below code in swift 5.0

您可以尝试使用以下代码 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

您可以使用 Bundle

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

回答by Deepak Saki

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>