Skip to content
This repository has been archived by the owner on Jul 16, 2019. It is now read-only.

Photo Gallety Permission Denied Crash #72

Open
vishaldeshai opened this issue Feb 14, 2017 · 3 comments
Open

Photo Gallety Permission Denied Crash #72

vishaldeshai opened this issue Feb 14, 2017 · 3 comments
Assignees
Labels
Milestone

Comments

@vishaldeshai
Copy link

Hello,

I need to ask permission before open GMPicker.

If i denied permission then app crash.

thanks in advance.

@philippeauriach
Copy link

Seing this as well. To reproduce : launch GMImagePicker => deny permission => cancel => crash

@nguyenthinam
Copy link

@vishaldeshai @philippeauriach
You should check/require permission before using GMImagePicker. The problem will be gone, draft codes below:

    PHAuthorizationStatus authStatus = [PHPhotoLibrary authorizationStatus];
    
    if (authStatus == PHAuthorizationStatusAuthorized) {
        // Have permission -> Open GMImagePicker
    } 
    else if (authStatus == PHAuthorizationStatusDenied) {
        // No permission > Let user knows s/he should grant permission to continue
    } 
    else {
        [PHPhotoLibrary requestAuthorization:^(PHAuthorizationStatus status) {
            BOOL granted = (status == PHAuthorizationStatusAuthorized);
            dispatch_async(dispatch_get_main_queue(), ^{
                // If Have permission -> Open GMImagePicker
                // Else -> Let user knows s/he should grant permission to continue
            });
        }];
    }

@philippeauriach
Copy link

That is indeed what I did, but it is not in my opinion a correct solution for your library : as GMImagePicker handles permission asking, it should also handle the "permission denied" case, because developers would expect that from the lib.

@guillermomuntaner guillermomuntaner added this to the 0.1.0 milestone Sep 21, 2017
@guillermomuntaner guillermomuntaner self-assigned this Sep 21, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants