PHPhotoLibrary.requestAuthorization(for:, handler:) does not calls handler block

送分小仙女□ 提交于 2021-01-29 07:01:18

问题


I use new API for requesting of access for an assets library of a user:

PHPhotoLibrary.requestAuthorization(for: .readWrite) { 
                [weak self] (status:PHAuthorizationStatus) in
                print("called");
            }

iOS displays alert with access levels:

If the user selects Select Photos..., iOS will show a picker:

If user swipes down on a title of the picker, the photos library will not call the handler block.

Implementation of the photoLibraryDidChange

 func photoLibraryDidChange(_ changeInstance: (PHChange)) {
        guard let fetchResult = self.fetchResult else {
            return
        }
        if changeInstance.changeDetails(for: fetchResult) != nil {
            DispatchQueue.main.async {
                self.delegate?.photosLibraryChanged(self)
            }
        }
    }

Does someone faced with this situation? And how I can fix it?

Example: https://github.com/K-Be/NewInPhotoKitInIOS14

来源:https://stackoverflow.com/questions/65351479/phphotolibrary-requestauthorizationfor-handler-does-not-calls-handler-block

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!