use*_*232 148 camera barcode plist ios ios-permissions
使用iOS 10.0上一个测试版 我曾尝试使用Camera在我的应用程序中扫描条形码,并且它因此运行时错误而崩溃.
此应用程序已崩溃,因为它试图在没有使用说明的情况下访问隐私敏感数据.应用程序的Info.plist必须包含一个NSCameraUsageDescription键,其中包含一个字符串值,向用户解释应用程序如何使用此数据.
将这把钥匙放入plist,但它仍然坠毁?
Bho*_*opi 211
在iOS 10之后,您必须定义并提供您的应用在Info.plist中访问的所有系统隐私敏感数据的使用说明,如下所示:
日历
Key : Privacy - Calendars Usage Description
Value : $(PRODUCT_NAME) calendar events
Run Code Online (Sandbox Code Playgroud)
提醒 :
Key : Privacy - Reminders Usage Description
Value : $(PRODUCT_NAME) reminder use
Run Code Online (Sandbox Code Playgroud)
联系 :
Key : Privacy - Contacts Usage Description
Value : $(PRODUCT_NAME) contact use
Run Code Online (Sandbox Code Playgroud)
照片:
Key : Privacy - Photo Library Usage Description
Value : $(PRODUCT_NAME) photo use
Run Code Online (Sandbox Code Playgroud)
蓝牙共享:
Key : Privacy - Bluetooth Peripheral Usage Description
Value : $(PRODUCT_NAME) Bluetooth Peripheral use
Run Code Online (Sandbox Code Playgroud)
麦克风:
Key : Privacy - Microphone Usage Description
Value : $(PRODUCT_NAME) microphone use
Run Code Online (Sandbox Code Playgroud)
相机:
Key : Privacy - Camera Usage Description
Value : $(PRODUCT_NAME) camera use
Run Code Online (Sandbox Code Playgroud)
地点 :
Key : Privacy - Location Always Usage Description
Value : $(PRODUCT_NAME) location use
Key : Privacy - Location When In Use Usage Description
Value : $(PRODUCT_NAME) location use
Run Code Online (Sandbox Code Playgroud)
希思:
Key : Privacy - Health Share Usage Description
Value : $(PRODUCT_NAME) heath share use
Key : Privacy - Health Update Usage Description
Value : $(PRODUCT_NAME) heath update use
Run Code Online (Sandbox Code Playgroud)
HomeKit:
Key : Privacy - HomeKit Usage Description
Value : $(PRODUCT_NAME) home kit use
Run Code Online (Sandbox Code Playgroud)
媒体库:
Key : Privacy - Media Library Usage Description
Value : $(PRODUCT_NAME) media library use
Run Code Online (Sandbox Code Playgroud)
动议:
Key : Privacy - Motion Usage Description
Value : $(PRODUCT_NAME) motion use
Run Code Online (Sandbox Code Playgroud)
语音识别 :
Key : Privacy - Speech Recognition Usage Description
Value : $(PRODUCT_NAME) speech use
Run Code Online (Sandbox Code Playgroud)
SiriKit:
Key : Privacy - Siri Usage Description
Value : $(PRODUCT_NAME) siri use
Run Code Online (Sandbox Code Playgroud)
电视提供商:
Key : Privacy - TV Provider Usage Description
Value : $(PRODUCT_NAME) tvProvider use
Run Code Online (Sandbox Code Playgroud)
您可以在此链接中获取详细信息.
Ram*_*rma 104
Apple已经改变了如何访问任何用户私有数据类型的方法iOS 10.
您需要Privacy - Camera usage description在应用程序中添加" "键Info.plist及其适用于您的应用程序的使用信息,如下面我提供的用于扫描条形码的示例.
有关更多信息,请查看以下屏幕截图.
aya*_*aya 42
或者打开Info.plist作为源代码并添加:
<key>NSCameraUsageDescription</key>
<string>Camera usage description</string>
Run Code Online (Sandbox Code Playgroud)
Xei*_*han 28
使用这些原始值并复制到info.plist中
<key>NSCalendarsUsageDescription</key>
<string>$(PRODUCT_NAME) calendar events</string>
<key>NSRemindersUsageDescription</key>
<string>$(PRODUCT_NAME) reminder use</string>
<key>NSCameraUsageDescription</key>
<string>This app requires to access your photo library to show image on profile and send via chat</string>
<key>NSMicrophoneUsageDescription</key>
<string>This app requires to access your microphone to record video with your voice send via chat</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>This app requires to access your photo library to show image on profile and send via chat</string>
<key>NSContactsUsageDescription</key>
<string>$(PRODUCT_NAME) contact use</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>$(PRODUCT_NAME) location use</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>$(PRODUCT_NAME) location use</string>
Run Code Online (Sandbox Code Playgroud)
use*_*025 24
xcode UI已经从一个版本更改为下一个版本,所以这里是更新plist for 9.0 beta 4的地方,如果它有助于Project - > Target - > Info
小智 8
如果您使用的是 Ionic,您可以通过添加内部平台 ios 标签直接从config.xml解决该问题:
<platform name="ios">
.
.
.
<config-file target="*-Info.plist" parent="NSPhotoLibraryUsageDescription">
<string>photo library usage description</string>
</config-file>
<config-file target="*-Info.plist" parent="NSCameraUsageDescription">
<string>camera usage description</string>
</config-file>
.
.
.
</platform>
Run Code Online (Sandbox Code Playgroud)
我也想感谢@BHUPI 的回答。
对于那些即使您在 Info.plist 中添加了正确的键仍然出现错误的人:
确保您将密钥添加到正确的 Info.plist 中。较新版本的 xCode,显然有 3 个 Info.plist。
一个是在您的应用程序名称的文件夹下,这为我解决了问题。
第二个在 YourappnameTests 下,第三个在 YourappnameUITests 下。
希望能帮助到你。
| 归档时间: |
|
| 查看次数: |
138633 次 |
| 最近记录: |