How may I check if my app has access to phone gallery

gallery, ios, uiimage

Solution

You need to check the status of `ALAssetLibrary` make sure you have `AssetsLibrary/AssetsLibrary.h` included in your file

  ALAuthorizationStatus status = [ALAssetsLibrary authorizationStatus];

// check the status for `ALAuthorizationStatusAuthorized` or `ALAuthorizationStatusDenied` e.g

    if (status != ALAuthorizationStatusAuthorized) {
        //show alert for asking the user to give permission

    }

Problem

I have an app in which I take a picture with the camera and store that image into the native gallery. But if the app doesn't have permission for that, I want the user to know that. So how do I check it? By the way: I store the image into the gallery with: ``` UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil); ```

Original source