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

Flutter iOS应用提交App Store遇ITMS-91061及依赖冲突问题

解决Flutter iOS App提交App Store时的ITMS-91061隐私清单错误及依赖冲突问题

核心问题梳理

  • 提交App Store触发ITMS-91061:GTMSessionFetcher和GoogleToolboxForMac缺少隐私清单
  • 手动更新上述SDK版本后,引发Firebase/ML Kit与Flutter插件的依赖冲突
  • Pod安装、flutter pub get均因版本不兼容失败
  • 降级SDK会重新触发隐私清单错误

分步解决方案

1. 对齐Flutter Firebase插件与原生SDK版本

手动修改Podfile中的原生Firebase版本会破坏Flutter插件的依赖绑定,必须通过Flutter端插件版本统一控制:

  • 打开项目根目录的pubspec.yaml,确保所有firebase_*插件(如cloud_firestore、firebase_auth、firebase_analytics)使用兼容的统一大版本。示例配置:
    dependencies:
      flutter:
        sdk: flutter
      cloud_firestore: ^4.17.0
      firebase_auth: ^4.17.0
      firebase_analytics: ^10.17.0
      firebase_crashlytics: ^3.4.0
      firebase_storage: ^11.6.0
      google_mlkit_text_recognition: ^0.12.0
    
  • 执行命令更新依赖,自动对齐版本:
    flutter pub upgrade
    flutter pub get
    

2. 强制拉取带隐私清单的GTMSessionFetcher/GoogleToolboxForMac版本

通过Podfile的post_install钩子,在不破坏依赖链的前提下强制指定这两个SDK的最新版本(带隐私清单):

  • 修改iOS目录下的Podfile,添加以下配置:
    platform :ios, '16.4'
    
    # 保留原有配置...
    
    post_install do |installer|
      installer.pods_project.targets.each do |target|
        flutter_additional_ios_build_settings(target)
        # 适配部署目标版本
        if ['GTMSessionFetcher', 'GoogleToolboxForMac'].include?(target.name)
          target.build_configurations.each do |config|
            config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '16.4'
          end
        end
      end
      # 强制指定SDK版本
      installer.pod_targets.each do |pod|
        if pod.name == 'GTMSessionFetcher'
          pod.version = '4.3.0'
        elsif pod.name == 'GoogleToolboxForMac'
          pod.version = '4.1.0'
        end
      end
    end
    
  • 清理旧Pod缓存并重新安装:
    cd ios
    pod deintegrate
    rm Podfile.lock
    pod install
    
  • 验证隐私清单是否存在:
    find Pods -name "PrivacyInfo.xcprivacy"
    
    输出需包含Pods/GTMSessionFetcher/PrivacyInfo.xcprivacy和Pods/GoogleToolboxForMac/PrivacyInfo.xcprivacy。

3. 解决Firestore依赖冲突

若仍出现CocoaPods could not find compatible versions for pod "Firebase/Firestore"错误:

  • 检查pubspec.yaml中cloud_firestore的版本,确保其对应的原生Firebase/Firestore版本与其他Firebase插件兼容(例如cloud_firestore ^4.17.0对应原生Firebase/Firestore 11.7.0)。
  • 执行pod repo update更新本地CocoaPods仓库,再重新执行pod install。

4. 临时补救:手动添加隐私清单(若自动拉取失败)

如果上述步骤后Apple仍未检测到隐私清单,可手动添加:

  • 在iOS项目中创建PrivacyInfo.xcprivacy文件,添加以下内容(根据SDK实际权限需求调整):
    <?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>NSPrivacyAccessedAPITypes</key>
      <array>
        <dict>
          <key>NSPrivacyAccessedAPIType</key>
          <string>NSPrivacyAccessedAPICategoryNetwork</string>
          <key>NSPrivacyAccessedAPITypeReasons</key>
          <array>
            <string>CA92.1</string>
          </array>
        </dict>
      </array>
    </dict>
    </plist>
    
  • 在Xcode中,将该文件添加到所有target的Copy Bundle Resources中,重新打包归档。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.14 07:04:57