首页 > 解决方案 > Swift 包:xctest:此应用程序试图在没有使用说明的情况下访问隐私敏感数据

问题描述

运行测试(在我的 Swift 包中指定的测试目标)并获取位置(通过调用requestWhenInUseAuthorization())时,我得到:

xctest[66200:894249] This app has attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain an “NSLocationWhenInUseUsageDescription” key with a string value explaining to the user how the app uses this data

但是,我运行的不是应用程序,而是 Swift Package 目标。我不相信我什至可以为 Swift 包指定 Info.plist。我该如何避免这种情况?


这与xctest 不同 此应用程序试图在没有使用说明的情况下访问隐私敏感数据,因为该帖子的应用程序具有Info.plist.

标签: iosswiftxctestswift-package-manager

解决方案


推荐阅读