Pergunta

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.

Foi útil?

Solução

try [ALAssetsLibrary authorizationStatus] == ALAuthorizationStatusAuthorized

Make sure to include the "AssetsLibrary" framework in your project and add #import <AssetsLibrary/AssetsLibrary.h> to your file.

Outras dicas

Here is the Swift equivalent.

import AssetsLibrary

After importing, calling ALAssetsLibrary.authorizationStatus() returns either

NotDetermined

Restricted

Denied

Authorized

from the ALAuthorizationStatus enum.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top