UIImagePickerController crashes app | Swift3, Xcode8

后端 未结 4 539
长情又很酷
长情又很酷 2020-12-01 10:34

FYI: I´m new to Swift so this might be a really simple problem but I just can´t figure it out.

I have been following the Start Developing iOS Apps (Swift) t

相关标签:
4条回答
  • 2020-12-01 11:09

    I tried adding the privacy messages but those didn't work for me. Then I looked at the Attributes Inspector for the image element itself and checked the box 'User Interaction Enabled', which had previously been unchecked. After doing this, the picker worked. Hope it helps someone.

    0 讨论(0)
  • 2020-12-01 11:16

    Noticed a camera key and value needed for camera usage as well.

    Keys required for both the camera and photo library that need to be in the info.plist:

    <key>NSCameraUsageDescription</key>
    <string>Access needed to use your camera.</string>
    
    <key>NSPhotoLibraryUsageDescription</key>
    <string>Access needed to photo gallery.</string>
    
    0 讨论(0)
  • 2020-12-01 11:24

    In xcode 8 new key is added Privacy For -

    Media,Location,Photo Library,Reminders,Motion,Calender,Bluetooth,HomeKit,Camera,Contacts etc.. and value is Description for the privacy you will access for.For ex. "We need access to use photo library to make functionality work" or ANY_YOUR_APP_RELATED_DESCRIPTION.

    0 讨论(0)
  • 2020-12-01 11:30

    Add this key to your info.plist,

    Key : Privacy - Photo Library Usage Description [ NSPhotoLibraryUsageDescription ]
    String Value : We need access to your camera roll and photo library, so that we can do operations on it. [ Customise it in your own way] 
    

    That's it, Clean & Run the project.

    0 讨论(0)
提交回复
热议问题