swiftpermissionsinfo.plistsmooch

How to enable "Take a quick photo" option during chats in Smooch SDK for SWIFT?


I'm using Smooch SDK for adding chat feature to my iOS application.

According to its documentation, it suggests to add below keys to Info.plist to allow users send photos or capture photos from camera.

<key>NSPhotoLibraryUsageDescription</key>
<string>${PRODUCT_NAME} will read your photo library to gather additional information</string>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>${PRODUCT_NAME} will write to your photo library to gather additional information</string>
<key>NSCameraUsageDescription</key>
<string>${PRODUCT_NAME} will use your camera to gather additional information</string>

However when I try to send items during chat, only "Photo & Video Library" and "Upload Document" is enabled and "Take a Quick Photo" is not present.

Do I need to do more actions to enable "Take a Quick Photo" option?


Solution

  • As mentioned in the comments, for the "Take a Quick Photo" to appear, the following conditions must all evaluate to true

    [UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]
    [[[NSBundle mainBundle] infoDictionary] objectForKey:@"NSCameraUsageDescription"] != nil
    [[[NSBundle mainBundle] infoDictionary] objectForKey:@"NSPhotoLibraryAddUsageDescription"] != nil
    

    Additionally, the SKTSettings.allowedMenuItems array must include an entry for SKTMenuItemCamera (this is enabled by default)