Present to the user limited library for state PHAuthorizationStatusLimited

370 views Asked by At

Trying to use the following code when PhPhoto status is PHAuthorizationStatusLimited

PHAuthorizationStatus prevStatus = [PHPhotoLibrary authorizationStatus];
if (prevStatus == PHAuthorizationStatusLimited)
        {
            [PHPhotoLibrary requestAuthorizationForAccessLevel:(PHAccessLevelReadWrite) handler:^(PHAuthorizationStatus status) {
                if (status == PHAuthorizationStatusLimited) {
                    dispatch_async(dispatch_get_main_queue(), ^{
                        [PHPhotoLibrary presentLimitedLibraryPickerFromViewController:self];
                    });
                }
            }];

I get No known class method for selector 'presentLimitedLibraryPickerFromViewController: [PHPhotoLibrary presentLimitedLibraryPickerFromViewController:self];

I need to show the user the limited library to select photos. Are there any other options at this specific state? What am i missing?

1

There are 1 answers

0
Idriss Sakhi On

You need to init viewController that handles the display before =>

UIViewController *presentedViewController = RCTPresentedViewController();
[[PHPhotoLibrary sharedPhotoLibrary] presentLimitedLibraryPickerFromViewController:presentedViewController];