uni-app iOS 审核警告 需要配置 NSPrivacyAccessedAPICategoryDiskSpace?
uni-app iOS 审核警告 需要配置 NSPrivacyAccessedAPICategoryDiskSpace?
操作步骤:
- 请看描述
预期结果:
- 请看描述
实际结果:
- 请看描述
bug描述:
Hello,
We noticed one or more issues with a recent submission for App Store review for the following app:
- guangzhougrocery
- Version 1.0.0
- Build 104
Although submission for App Store review was successful, you may want to correct the following issues in your next submission for App Store review. Once you’ve corrected the issues, upload a new binary to App Store Connect.
- ITMS-91053: Missing API declaration - Your app’s code in the “HBuilder” file references one or more APIs that require reasons, including the following API categories: NSPrivacyAccessedAPICategoryDiskSpace. While no action is required at this time, starting May 1, 2024, when you upload a new app or app update, you must include a NSPrivacyAccessedAPITypes array in your app’s privacy manifest to provide approved reasons for these APIs used by your app’s code. For more details about this policy, including a list of required reason APIs and approved reasons for usage, visit: https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api.
- ITMS-91053: Missing API declaration - Your app’s code in the “HBuilder” file references one or more APIs that require reasons, including the following API categories: NSPrivacyAccessedAPICategoryFileTimestamp. While no action is required at this time, starting May 1, 2024, when you upload a new app or app update, you must include a NSPrivacyAccessedAPITypes array in your app’s privacy manifest to provide approved reasons for these APIs used by your app’s code. For more details about this policy, including a list of required reason APIs and approved reasons for usage, visit: https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api.
- ITMS-91053: Missing API declaration - Your app’s code in the “HBuilder” file references one or more APIs that require reasons, including the following API categories: NSPrivacyAccessedAPICategorySystemBootTime. While no action is required at this time, starting May 1, 2024, when you upload a new app or app update, you must include a NSPrivacyAccessedAPITypes array in your app’s privacy manifest to provide approved reasons for these APIs used by your app’s code. For more details about this policy, including a list of required reason APIs and approved reasons for usage, visit: https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api.
- ITMS-91053: Missing API declaration - Your app’s code in the “HBuilder” file references one or more APIs that require reasons, including the following API categories: NSPrivacyAccessedAPICategoryUserDefaults. While no action is required at this time, starting May 1, 2024, when you upload a new app or app update, you must include a NSPrivacyAccessedAPITypes array in your app’s privacy manifest to provide approved reasons for these APIs used by your app’s code. For more details about this policy, including a list of required reason APIs and approved reasons for usage, visit: https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api.
Apple Developer Relations
在开发 uni-app 应用并提交到 iOS App Store 时,你可能会收到来自 Apple 的审核警告,提示需要配置 NSPrivacyAccessedAPICategoryDiskSpace
。这是因为 Apple 对用户隐私和数据使用的管理越来越严格,要求开发者明确声明应用中访问了哪些敏感 API 或数据类别。
背景
iOS 14 开始,Apple 引入了 App Privacy 功能,要求开发者在 App Store Connect 中声明应用访问的用户数据类型和 API。NSPrivacyAccessedAPICategoryDiskSpace
是其中的一个类别,表示应用访问了设备的磁盘空间信息。
如果你在应用中使用了获取设备存储空间相关的 API(例如查询剩余磁盘空间),就需要在 Info.plist
文件中声明 NSPrivacyAccessedAPICategoryDiskSpace
。
解决方案
-
确认是否使用了相关 API
- 如果你的应用确实使用了获取磁盘空间的 API(例如通过
uni.getSystemInfo
获取存储信息),则需要声明NSPrivacyAccessedAPICategoryDiskSpace
。 - 如果你不确定,可以检查代码中是否调用了类似的功能。
- 如果你的应用确实使用了获取磁盘空间的 API(例如通过
-
在
Info.plist
中添加声明 在你的 uni-app 项目中,找到Info.plist
文件(通常位于nativeplugins
或platforms/ios
目录下),并添加以下内容:<key>NSPrivacyAccessedAPICategories</key> <array> <dict> <key>NSPrivacyAccessedAPICategory</key> <string>NSPrivacyAccessedAPICategoryDiskSpace</string> <key>NSPrivacyAccessedAPIType</key> <string>NSPrivacyAccessedAPITypeRead</string> <key>NSPrivacyAccessedAPITypeReasons</key> <array> <string>我们需要访问设备存储空间信息,以便优化应用的性能和功能。</string> </array> </dict> </array>