[英]Can't access the Documents directory when iPhone is getting locked?
Scenario 1 . 场景1 。 I used this code for downloading files from Dropbox using Dropbox SDK. 我使用此代码使用Dropbox SDK从Dropbox下载文件。
-(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. 场景2.每当我想播放Documents目录中的歌曲时。 it won't play when iPhone is getting Password Locked. 当iPhone 获得密码锁定时,它将无法播放。 Current song also stopped with in fraction of seconds. 当前的歌曲也在几分之一秒内停止。
It's not possible. 这是不可能的。 However, you can "prevent" your phone from locking when your app is running. 但是,您可以在应用运行时“阻止”手机锁定。 [UIApplication sharedApplication].idleTimerDisabled = YES should do it. [UIApplication sharedApplication] .idleTimerDisabled = YES应该这样做。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.