在 PHPhotoLibrary presentLimitedLibraryPickerFromViewController 行崩溃无法识别的选择器发送到实例

Crash at PHPhotoLibrary presentLimitedLibraryPickerFromViewController line unrecognised selector send to instance

我正在尝试展示 Limited 图像选择器,但我得到了

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[PHPhotoLibrary presentLimitedLibraryPickerFromViewController:] 

我正在使用

#import <Photos/Photos.h>
#import <PhotosUI/PhotosUI.h>

尽管 self 是 viewcontroller

,但此行崩溃了
   [[PHPhotoLibrary sharedPhotoLibrary] presentLimitedLibraryPickerFromViewController:self];

知道为什么吗?

快速搜索发现:

可能是“错误”...可能是错误的文档...

PhotosUI.framework 添加到您的目标: