如何放入Info.plist 2 <key>CFBundleURLTypes</key>

au *_*ina 5 info.plist ios firebase google-cloud-platform nativescript

我想使用来自 google 和 facebook 的身份验证插件

我想放入Info.plist

对于谷歌:

<key>CFBundleURLTypes</key>
    <array>
        <dict>
            <key>CFBundleTypeRole</key>
            <string>Editor</string>
            <key>CFBundleURLName</key>
            <string>REVERSED_CLIENT_ID</string>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>com.googleusercontent.apps.1052836194035-l81fsjai1u40ocnqjcpnoebnnsltt03b</string>
            </array>
        </dict>
    </array>
Run Code Online (Sandbox Code Playgroud)

对于脸书:

<key>CFBundleURLTypes</key>
<array>
  <dict>
    <key>CFBundleURLSchemes</key>
    <array>
      <string>fb{your-app-id}</string>
    </array>
  </dict>
</array>
<key>FacebookAppID</key>
<string>{your-app-id}</string>
<key>FacebookDisplayName</key>
<string>{your-app-name}</string>
<key>LSApplicationQueriesSchemes</key>
<array>
  <string>fbapi</string>
  <string>fb-messenger-share-api</string>
  <string>fbauth2</string>
  <string>fbshareextension</string>
</array>
Run Code Online (Sandbox Code Playgroud)

如何在一个 Info.plist 中同时使用两者?

当我在 facebook 中删除 CFBundleURLTypes 时,在控制台中显示错误:解析时缺少密钥

有什么想法吗?

小智 8

将实体组合在相同的密钥下,如下所示:(您可以使用以下内容)

<key>CFBundleURLTypes</key>
    <array>
        <dict>
            <key>CFBundleTypeRole</key>
            <string>Editor</string>
            <key>CFBundleURLName</key>
            <string>REVERSED_CLIENT_ID</string>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>com.googleusercontent.apps.1052836194035-l81fsjai1u40ocnqjcpnoebnnsltt03b</string>
               <string>fb{your-app-id}</string>
            </array>
        </dict>
    </array>
<key>FacebookAppID</key>
<string>{your-app-id}</string>
<key>FacebookDisplayName</key>
<string>{your-app-name}</string>
<key>LSApplicationQueriesSchemes</key>
<array>
  <string>fbapi</string>
  <string>fb-messenger-share-api</string>
  <string>fbauth2</string>
  <string>fbshareextension</string>
</array>

Run Code Online (Sandbox Code Playgroud)