简体   繁体   English

iPhone被锁定时无法访问Documents目录?

[英]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.

相关问题 还有其他方法可以在iDevice锁定状态下访问文档目录吗? - Any other ways to access Documents Directory on iDevice Locked State? 当iPhone处于具有锁定状态的后台模式时,NSDATA没有写入Documents Dir? - The NSDATA is not writing into Documents Dir, when iPhone on Background mode with Locked State? 即使应用未运行且iPhone处于锁定状态,您的iOS应用仍可以使用语音/语音识别吗? - Can your iOS app use speech/voice recognition even when the app isn't running and the iPhone is locked? 当 iPhone 被锁定时,我们无法批准或拒绝来自 Apple Watch 的通知 - When iPhone is locked we can't approve or deny notification from apple watch 无法从iPhone文档目录位置中的已保存文件重新加载UIImage - Can't Reload UIImage from Saved file in iPhone Documents Directory location 锁定后,AVAudioPlayer无法在iPhone 5中播放音频 - AVAudioPlayer doesn't play audio in iPhone 5 when locked iPhone 锁定时没有声音启动 (Swift) - Sound doesn't start when the iPhone is locked (Swift) iPhone锁定时,非本机Apple Watch应用程序可以工作吗? - Can an not native Apple watch app work when the iPhone is locked? iPhone:即使手机处于锁定模式,也可以访问任何应用程序吗? - iPhone: Can any application be accessed even when the phone is in locked mode? 无法从iPhone / iPhone模拟器的“文档”文件夹中加载图像 - Can't load images from “Documents” folder in iPhone/iPhone Simulator
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM