You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ionic 6 Capacitor iOS Info.plist配置警告修复求助

Ionic 6 + Capacitor 中Facebook/Google登录配置警告排查修复

在Ionic 6结合Capacitor的项目中,已为Facebook登录与Google登录配置Info.plist,但执行cap sync命令后仍持续收到配置缺失警告,以下是排查修复方案:

执行cap sync后收到的警告信息

[capacitor] [warn] Configuration might be missing for cordova-plugin-facebook-connect.
[capacitor]        Add the following to the existing CFBundleURLTypes entry of Info.plist:
[capacitor]        
[capacitor]        <dict>
[capacitor]        <key>CFBundleURLSchemes</key>
[capacitor]        <array>
[capacitor]        <string>fb$APP_IDFACEBOOK_URL_SCHEME_SUFFIX_PLACEHOLDER</string>
[capacitor]        <string>OTHER_APP_SCHEMES_PLACEHOLDER</string>
[capacitor]        </array>
[capacitor]        </dict>
[capacitor]        
[capacitor] [warn] Configuration might be missing for cordova-plugin-googleplus.
[capacitor]        Add the following to the existing CFBundleURLTypes entry of Info.plist:
[capacitor]        
[capacitor]        <dict>
[capacitor]        <key>CFBundleTypeRole</key>
[capacitor]        <key>CFBundleURLName</key>
[capacitor]        <key>CFBundleURLSchemes</key>
[capacitor]        <string>Editor</string>
[capacitor]        <string>REVERSED_CLIENT_ID</string>
[capacitor]        <array>
[capacitor]        <string>$REVERSED_CLIENT_ID</string>
[capacitor]        </array>
[capacitor]        </dict>
[capacitor]        
[capacitor] [warn] Configuration might be missing for cordova-plugin-facebook-connect.
[capacitor]        Add the following to the existing NSAppTransportSecurity entry of Info.plist:
[capacitor]        
[capacitor]        <key>NSExceptionDomains</key>
[capacitor]        <dict>
[capacitor]        <key>facebook.com</key>
[capacitor]        <key>fbcdn.net</key>
[capacitor]        <key>akamaihd.net</key>
[capacitor]        <dict>
[capacitor]        <key>NSIncludesSubdomains</key>
[capacitor]        <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
[capacitor]        <true/>
[capacitor]        <false/>
[capacitor]        </dict>
[capacitor]        <dict>
[capacitor]        <key>NSIncludesSubdomains</key>
[capacitor]        <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
[capacitor]        <true/>
[capacitor]        <false/>
[capacitor]        </dict>
[capacitor]        <dict>
[capacitor]        <key>NSIncludesSubdomains</key>
[capacitor]        <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
[capacitor]        <true/>
[capacitor]        <false/>
[capacitor]        </dict>
[capacitor]        </dict>

当前Info.plist文件内容

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleDevelopmentRegion</key>
    <string>en</string>
    <key>CFBundleDisplayName</key>
    <string>myappname</string>
    <key>CFBundleExecutable</key>
    <string>$(EXECUTABLE_NAME)</string>
    <key>CFBundleIdentifier</key>
    <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>$(PRODUCT_NAME)</string>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleShortVersionString</key>
    <string>$(MARKETING_VERSION)</string>
    <key>CFBundleVersion</key>
    <string>$(CURRENT_PROJECT_VERSION)</string>
    <key>LSRequiresIPhoneOS</key>
    <true/>
    <key>UILaunchStoryboardName</key>
    <string>LaunchScreen</string>
    <key>UIMainStoryboardFile</key>
    <string>Main</string>
    <key>UIRequiredDeviceCapabilities</key>
    <array>
        <string>armv7</string>
    </array>
    <key>CFBundleURLTypes</key>
    <array>
        <dict>
            <key>CFBundleTypeRole</key>
            <string>Role</string>
            <key>CFBundleURLName</key>
            <string>REVERSED_CLIENT_ID</string>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>REVERSED_CLIENT_ID</string>
            </array>
        </dict>
                <dict>
                <key>CFBundleURLSchemes</key>
                 <string>REVERSED_CLIENT_ID</string>
            </dict>
                    <dict>
                    <key>CFBundleURLSchemes</key>
                    <array>
                        <string>fb$APP_IDFACEBOOK_URL_SCHEME_SUFFIX_PLACEHOLDER</string>
                        <string>OTHER_APP_SCHEMES_PLACEHOLDER</string>
                    </array>
                </dict>
    </array>
    <key>NSAppTransportSecurity</key>
    <dict>
        <key>NSExceptionDomains</key>
        <dict>
            <key>facebook.com</key>
            <dict/>
            <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
            <false/>
            <key>NSIncludesSubdomains</key>
            <true/>
            <key>fbcdn.net</key>
            <dict>
                <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
                <false/>
                <key>NSIncludesSubdomains</key>
                <true/>
            </dict>
            <key>akamaihd.net</key>
            <dict>
                <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
                <false/>
                <key>NSIncludesSubdomains</key>
                <true/>
            </dict>
        </dict>
    </dict>
    <key>UISupportedInterfaceOrientations</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
    <key>UISupportedInterfaceOrientations~ipad</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationPortraitUpsideDown</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
    <key>UIViewControllerBasedStatusBarAppearance</key>
    <true/>
    <key>FacebookUrlSchemeSuffix</key>
    <string>FACEBOOK_URL_SCHEME_SUFFIX_PLACEHOLDER</string>
    <key>FacebookHybridAppEvents</key>
    <string>$FACEBOOK_HYBRID_APP_EVENTS</string>
    <key>NSPhotoLibraryUsageDescription</key>
    <string>This app requires photo library access to function properly.</string>
    <key>NSCalendarsUsageDescription</key>
    <string>This app requires calendar access to function properly.</string>
    <key>FacebookDisplayName</key>
    <string>$APP_NAME</string>
    <key>NSLocationWhenInUseUsageDescription</key>
    <string>$LOCATION_USAGE_DESCRIPTION</string>
    <key>NSMotionUsageDescription</key>
    <string>This app requires motion detection access to function properly.</string>
    <key>NSBluetoothPeripheralUsageDescription</key>
    <string>This app requires Bluetooth access to function properly.</string>
    <key>NSMicrophoneUsageDescription</key>
    <string>This app requires microphone access to function properly.</string>
    <key>NSCameraUsageDescription</key>
    <string>This app requires camera access to function properly.</string>
    <key>NSContactsUsageDescription</key>
    <string>This app requires contacts access to function properly.</string>
    <key>FacebookAutoLogAppEventsEnabled_PLACEHOLDER</key>
    <string>FACEBOOK_AUTO_LOG_APP_EVENTS_PLACEHOLDER</string>
    <key>FacebookAdvertiserIDCollectionEnabled_PLACEHOLDER</key>
    <string>FACEBOOK_ADVERTISER_ID_COLLECTION_PLACEHOLDER</string>
    <key>FacebookAppID</key>
    <string>$APP_ID</string>
    <key>NSRemindersUsageDescription</key>
    <string>This app requires reminders access to function properly.</string>
    <key>NSPhotoLibraryAddUsageDescription</key>
    <string>$PHOTO_LIBRARY_ADD_USAGE_DESCRIPTION</string>
    <key>LSApplicationQueriesSchemes</key>
    <array>
        <string>fbapi</string>
        <string>fb-messenger-api</string>
        <string>fbauth2</string>
        <string>fbshareextension</string>
        <string>citymapper</string>
        <string>comgooglemaps</string>
        <string>navigon</string>
        <string>transit</string>
        <string>waze</string>
        <string>yandexnavi</string>
        <string>uber</string>
        <string>tomtomhome</string>
        <string>com.sygic.aura</string>
        <string>here-route</string>
        <string>moovit</string>
        <string>lyft</string>
        <string>mapsme</string>
        <string>cabify</string>
        <string>baidumap</string>
        <string>taxis99</string>
        <string>iosamap</string>
    </array>
    <key>NSBluetoothAlwaysUsageDescription</key>
    <string>This app requires constant Bluetooth access to function properly.</string>
    <key>NSLocationAlwaysUsageDescription</key>
    <string>This app requires constant access to your location in order to track your position, even when the screen is off or the app is in the background.</string>
    <key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
    <string>This app requires constant access to your location in order to track your position, even when the screen is off or the app is in the background.</string>
</dict>
</plist>

排查修复步骤

1. 修正Google登录的CFBundleURLTypes配置

当前Google相关的URL类型存在两个问题:

  • CFBundleTypeRole的值错误,应为Editor而非Role
  • 存在重复的无效条目(仅包含CFBundleURLSchemes的dict)

修改后的CFBundleURLTypes中Google部分:

<dict>
    <key>CFBundleTypeRole</key>
    <string>Editor</string>
    <key>CFBundleURLName</key>
    <string>REVERSED_CLIENT_ID</string>
    <key>CFBundleURLSchemes</key>
    <array>
        <string>REVERSED_CLIENT_ID</string>
    </array>
</dict>

同时删除那个仅包含CFBundleURLSchemes的重复dict条目。

2. 修正Facebook登录的CFBundleURLTypes配置

当前Facebook的URL条目结构正确,但需确保占位符已替换为实际值:

  • 将fb$APP_IDFACEBOOK_URL_SCHEME_SUFFIX_PLACEHOLDER替换为fb{你的Facebook App ID}{可选的URL后缀},例如fb123456789
  • 将OTHER_APP_SCHEMES_PLACEHOLDER替换为你的应用自定义URL scheme(若有)

3. 修正NSAppTransportSecurity中Facebook相关配置

当前facebook.com的配置存在结构错误,NSThirdPartyExceptionRequiresForwardSecrecy和NSIncludesSubdomains被放在了facebook.com的dict外部,需移到内部:

修改后的NSAppTransportSecurity部分:

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSExceptionDomains</key>
    <dict>
        <key>facebook.com</key>
        <dict>
            <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
            <false/>
            <key>NSIncludesSubdomains</key>
            <true/>
        </dict>
        <key>fbcdn.net</key>
        <dict>
            <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
            <false/>
            <key>NSIncludesSubdomains</key>
            <true/>
        </dict>
        <key>akamaihd.net</key>
        <dict>
            <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
            <false/>
            <key>NSIncludesSubdomains</key>
            <true/>
        </dict>
    </dict>
</dict>

4. 替换所有剩余占位符

确保Info.plist中所有以$或_PLACEHOLDER结尾的占位符都替换为实际项目值:

  • $APP_ID → 你的Facebook App ID
  • $FACEBOOK_HYBRID_APP_EVENTS → 按需设置为true或false
  • $LOCATION_USAGE_DESCRIPTION → 实际的位置权限描述文本
  • 其他占位符同理替换为对应项目配置

完成以上修改后,重新执行cap sync命令,警告应会消失。

内容的提问来源于stack exchange,提问作者user13301788

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.18 20:55:22