Can't access the Documents directory when iPhone is getting locked?

679 views Asked by At

Scenario 1. I used this code for downloading files from Dropbox using 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 the songs from Documents directory. it won't play when iPhone is getting Password Locked. Current song also stopped with in fraction of seconds.

1

There are 1 answers

2
Sishu On

It's not possible. However, you can "prevent" your phone from locking when your app is running. [UIApplication sharedApplication].idleTimerDisabled = YES should do it.