iOS 10 - App crashes To access photo library or device camera via UIImagePickerController

前端 未结 2 1003
独厮守ぢ
独厮守ぢ 2020-12-06 14:58

Below is my code to access photo library

-(void)click_gallery
{

    if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhoto         


        
相关标签:
2条回答
  • 2020-12-06 15:29

    In iOS 10. You have to set privacy Setting for Camera & Photo Library.

    Camera :

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

    Photo Library:

    Key       :  Privacy - Photo Library Usage Description    
    Value     :  $(PRODUCT_NAME) photo use
    
    0 讨论(0)
  • 2020-12-06 15:47

    IOS 10 Now Requires User Permission to Access Media Library, Photos, Camera and other Hardware like these. The solution for this is to add their keys into info.plist with description for user that how we are using their data , iOS already required permissions to access microphone, camera, and media library earlier (iOS6, iOS7), but since iOS10 the apps will crash if you don't provide the description why you are asking for the permission.

    Add below key value in plist file.

    There is a list of all Cocoa Keys that you can specify in your Info.plist file

    Photo :

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

    Microphone :

    Key        :  Privacy - Microphone Usage Description    
    Value    :  $(PRODUCT_NAME) microphone use
    

    Camera :

    Key       :  Privacy - Camera Usage Description   
    Value   :  $(PRODUCT_NAME) camera use
    
    0 讨论(0)
提交回复
热议问题