You cannot successfully test this code on an xCode simulator. You need to use a real device (iPhone/iPad).
That being said, you could make sure that you have the correct settings in your info.plist:
Privacy - Media Library Usage Description -> set string value describing what needs authorization.
Post
Replies
Boosts
Views
Activity
I've submitted a formal request to help me solve this same issue. I will post here with any updates!