Can't access the Documents folder when iPhone is locked?

Scenario 1 . I used this code to download files from Dropbox using the Dropbox SDK.

-(void)downloadFile:(DBMetadata*)file
{
    if (!file.isDirectory)
    {
        NSString *documentsPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
        NSString *localPath = [documentsPath stringByAppendingPathComponent:file.filename];

        [[self restClientForDownload] loadFile:file.path intoPath:localPath];

    }

}

Scenario 2. Whenever I want to play songs from the Documents directory. It will not play when the iPhone receives a password locked. The current song also stopped in a split second.

+4
source share
1 answer

It's impossible. However, you can “block” your phone from being locked when the application is running. [UIApplication sharedApplication] .idleTimerDisabled = YES should do this.

+1

Source: https://habr.com/ru/post/1529870/


All Articles