PHPickerViewController crashes with the error 'Picker's configuration is not a valid configuration.' when I try to use PHPickerViewController with a configuration that has preselectedAssetIdentifiers
specified, and I can't figure out why.
The identifier looks like "12345678-1234-1234-123456789012/L0/001", and I'm getting it from PHPickerResult.assetIdentifier
. The exact same code works if I specify preselectedAssetIdentifiers
as an empty array.
I was worried that it was just undocumented that this feature required full photo library permissions, but after giving .readWrite permissions I still experience the issue.
My iPhone 13 Pro is running 15.4.1.
The only lead on this I've found is https://stackoverflow.com/questions/71765492/pickers-configuration-is-not-a-valid-configuration-swift, but I'm uncomfortable with the solution of recreating my project without identifying a cause that I can avoid in the future.
Hello,
Looking at the code in that post you linked to, they are setting a selectionLimit of 1.
The header comments for the preselectedAssetIdentifiers property (in PHPicker.h) says:
preselectedAssetIdentifiers should be an empty array if selectionLimit is 1 or photoLibrary is not specified.
So, at least in their case, it is likely that the selectionLimit of 1 is the issue, are you also setting a selectionLimit of 1?