Request Permission for Camera and Library in iOS 10 - Info.plist Request Permission for Camera and Library in iOS 10 - Info.plist ios ios

Request Permission for Camera and Library in iOS 10 - Info.plist


You can also request for access programmatically, which I prefer because in most cases you need to know if you took the access or not.

Swift 4 update:

    //Camera    AVCaptureDevice.requestAccess(for: AVMediaType.video) { response in        if response {            //access granted        } else {        }    }    //Photos    let photos = PHPhotoLibrary.authorizationStatus()    if photos == .notDetermined {        PHPhotoLibrary.requestAuthorization({status in            if status == .authorized{                ...            } else {}        })    }

You do not share code so I cannot be sure if this would be useful for you, but general speaking use it as a best practice.


You have to add the below permission in Info.plist. More Referance

Camera :

Key       :  Privacy - Camera Usage Description   Value     :  $(PRODUCT_NAME) camera use

Photo :

Key       :  Privacy - Photo Library Usage Description    Value     :  $(PRODUCT_NAME) photo use


Info.plist

Limited Photos

<key>PHPhotoLibraryPreventAutomaticLimitedAccessAlert</key><true/>

Camera

<key>NSCameraUsageDescription</key><string>$(PRODUCT_NAME) camera description.</string>

Photos

<key>NSPhotoLibraryUsageDescription</key><string>$(PRODUCT_NAME)photos description.</string>

Save Photos

<key>NSPhotoLibraryAddUsageDescription</key><string>$(PRODUCT_NAME) photos add description.</string>

Location

<key> NSLocationWhenInUseUsageDescription</key><string>$(PRODUCT_NAME) location description.</string>

Apple Music

<key>NSAppleMusicUsageDescription</key><string>$(PRODUCT_NAME) My description about why I need this capability</string>

Calendar

<key>NSCalendarsUsageDescription</key><string>$(PRODUCT_NAME) My description about why I need this capability</string>

Siri

<key>NSSiriUsageDescription</key><string>$(PRODUCT_NAME) My description about why I need this capability</string>