stefanosn
stefanosn

Reputation: 3324

Present to the user limited library for state PHAuthorizationStatusLimited

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?

Upvotes: 0

Views: 443

Answers (1)

Idriss Sakhi
Idriss Sakhi

Reputation: 295

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

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

Upvotes: 0

Related Questions