4

情景 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 被密码锁定时,它不会播放。当前歌曲也在几分之一秒内停止。

4

1 回答 1

1

这是不可能的。但是,您可以在应用程序运行时“防止”手机锁定。[UIApplication sharedApplication].idleTimerDisabled = YES 应该这样做。

于 2014-04-07T06:47:35.557 回答