![](/img/trans.png)
[英]Any other ways to access Documents Directory on iDevice Locked State?
[英]Can't access the Documents directory when iPhone is getting locked?
場景1 。 我使用此代碼使用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];
}
}
場景2.每當我想播放Documents目錄中的歌曲時。 當iPhone 獲得密碼鎖定時,它將無法播放。 當前的歌曲也在幾分之一秒內停止。
這是不可能的。 但是,您可以在應用運行時“阻止”手機鎖定。 [UIApplication sharedApplication] .idleTimerDisabled = YES應該這樣做。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.