iOS开发 Xcode8调用相机问题

一 ,遇到的问题


1 权限问题设置

iOS10系统下调用系统相册、相机功能,或者苹果健康都会遇到闪退的情况,
调用系统相册报错描述如下

This app has crashed because it attempted to access privacy-sensitive data without a usage description.The app's Info.plist must contain an NSPhotoLibraryUsageDescription key with a string value explaining to the user how the app uses this data

解决办法

在info.plist 根据需求添加

  • 需要注意的是 描述性字符串是一定要写的,不然会引发包无效的问题,导致上传打包后构建版本一直不显示

    NSPhotoLibraryUsageDescription
    App需要您的同意,才能访问相册

    NSCameraUsageDescription
    App需要您的同意,才能访问相机

    NSMicrophoneUsageDescription
    App需要您的同意,才能访问麦克风

    NSLocationUsageDescription
    App需要您的同意,才能访问位置

    NSLocationWhenInUseUsageDescription
    App需要您的同意,才能在使用期间访问位置

    NSLocationAlwaysUsageDescription
    App需要您的同意,才能始终访问位置

    NSCalendarsUsageDescription
    App需要您的同意,才能访问日历

    NSRemindersUsageDescription
    App需要您的同意,才能访问提醒事项

    NSMotionUsageDescription App需要您的同意,才能访问运动与健身

    NSHealthUpdateUsageDescription
    App需要您的同意,才能访问健康更新

    NSHealthShareUsageDescription
    App需要您的同意,才能访问健康分享

    NSBluetoothPeripheralUsageDescription
    App需要您的同意,才能访问蓝牙

    NSAppleMusicUsageDescription
    App需要您的同意,才能访问媒体资料库

你可能感兴趣的:(iOS开发 Xcode8调用相机问题)