Bruce Sackett
Bruce Sackett

Reputation: 55

Can I determine if user denied access to photos?

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

Answers (2)

thank_you
thank_you

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

Oliver Atkinson
Oliver Atkinson

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

Related Questions