Flutter 编译iOS代码提示错误 ITMS-91061: Missing privacy manifest ... Toast.framework...

flutter 代码在提交到App Store 的时候,收到提示邮件内容如下:

ITMS-91061: Missing privacy manifest** - Your app includes “Frameworks/Toast.framework/Toast”, which includes Toast, an SDK that was identified in the documentation as a privacy-impacting third-party SDK. Starting November 12, 2024, if a new app includes a privacy-impacting SDK, or an app update adds a new privacy-impacting SDK, the SDK must include a privacy manifest file. Please contact the provider of the SDK that includes this file to get an updated SDK version with a privacy manifest. For more details about this policy, including a list of SDKs that are required to include signatures and manifests, visit: https://developer.apple.com/support/third-party-SDK-requirements.

原因

首选需要了解Apple 发布了第三方SDK 的隐私名单,内容如下,如果提示类似上面的内容,大概率出错的SDK插件名字就在这个名单里:https://developer.apple.com/support/third-party-SDK-requirements/

解决方法

如果使用的是 fluttertoast 插件仍然出现这个错误,是因为 fluttertoast 内部仍然依赖了 Toast.framework。让我们来解决这个问题。

  • 首先,在 iOS 项目目录下创建一个 PrivacyInfo.xcprivacy 文件:
touch ios/Runner/PrivacyInfo.xcprivacy

在这个文件中添加如下内容:

{
    "NSPrivacyAccessedAPITypes": [
        {
            "NSPrivacyAccessedAPIType": "NSUserDefaults",
            "NSPrivacyAccessedAPITypeReasons": ["FE5F1F"]
        }
    ],
    "NSPrivacyCollectedDataTypes": [],
    "NSPrivacyTrackingDomains": []
}

修改 ios/Podfile,添加 post_install 配置:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
    
    # 添加隐私清单文件到所有依赖中
    target.build_configurations.each do |config|
      config.build_settings['PRIVACY_MANIFEST_PATH'] = '${PODS_TARGET_SRCROOT}/PrivacyInfo.xcprivacy'
    end
  end
end

然后重新安装 pods:

bashCopycd ios
pod deintegrate
rm -rf Pods/
rm -rf .symlinks/
rm -rf Podfile.lock
pod install

上面方法我亲测可用,重新打包上传到App Store 稍等一会就没有收到这个错误提示了。

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容