Objective C - How to detect user has clicked Don't Allow access to photos button

前端 未结 3 1682
一个人的身影
一个人的身影 2020-12-31 23:30

I am using a UIImagePicker to present the users photos so that the user can choose an image to be used in my app.

My problem is that on the first time a user opens t

3条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-01 00:11

    Got it!

    if ([ALAssetsLibrary authorizationStatus] == ALAuthorizationStatusNotDetermined) {
        ALAssetsLibrary *assetsLibrary = [[ALAssetsLibrary alloc] init];
        [assetsLibrary enumerateGroupsWithTypes:ALAssetsGroupAll usingBlock:^(ALAssetsGroup *group, BOOL *stop) {
            if (*stop) {
                // INSERT CODE TO PERFORM WHEN USER TAPS OK eg. :
                return;
            }
            *stop = TRUE;
        } failureBlock:^(NSError *error) {
            // INSERT CODE TO PERFORM WHEN USER TAPS DONT ALLOW, eg. :
            self.imagePickerController dismissViewControllerAnimated:YES completion:nil];
        }];
    }
    

提交回复
热议问题