flutter 代碼在提交到App Store 的時(shí)候,收到提示郵件內(nèi)容如下:
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 發(fā)布了第三方SDK 的隱私名單,內(nèi)容如下,如果提示類似上面的內(nèi)容,大概率出錯(cuò)的SDK插件名字就在這個(gè)名單里:https://developer.apple.com/support/third-party-SDK-requirements/
解決方法
如果使用的是 fluttertoast 插件仍然出現(xiàn)這個(gè)錯(cuò)誤,是因?yàn)?fluttertoast 內(nèi)部仍然依賴了 Toast.framework。讓我們來解決這個(gè)問題。
- 首先,在 iOS 項(xiàng)目目錄下創(chuàng)建一個(gè) PrivacyInfo.xcprivacy 文件:
touch ios/Runner/PrivacyInfo.xcprivacy
在這個(gè)文件中添加如下內(nèi)容:
{
"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
上面方法我親測(cè)可用,重新打包上傳到App Store 稍等一會(huì)就沒有收到這個(gè)錯(cuò)誤提示了。