Reputation: 55
In iOS, is there a way to check if the user has not allowed access to the photos on app launch? I am working on an app that uses the photo albums heavily, really as a requirement or nearly so, and would like to be able to have a contingency if they decide not to allow access.
Upvotes: 1
Views: 789
Reputation: 11107
Here is the Swift equivalent.
import AssetsLibrary
After importing, calling ALAssetsLibrary.authorizationStatus()
returns either
NotDetermined
Restricted
Denied
Authorized
from the ALAuthorizationStatus
enum.
Upvotes: 0
Reputation: 8029
try [ALAssetsLibrary authorizationStatus] == ALAuthorizationStatusAuthorized
Make sure to include the "AssetsLibrary" framework in your project and add #import <AssetsLibrary/AssetsLibrary.h>
to your file.
Upvotes: 9