【发布时间】:2014-03-03 19:12:06
【问题描述】:
场景 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 密码锁定时,它不会播放。当前歌曲也在几分之一秒内停止播放。
【问题讨论】:
-
您想在应用进入后台时继续播放音频?
-
ya.. 我想继续播放音频或从云端下载文件。但是当 iPhone 锁定时我需要访问文档目录? @Volker
-
后台模式开启了吗?
-
是的。我在后台模式下打开它 XCODE -> CAPABILITIES->。我检查的选项 1. Audio&airplay,2.BackgroundFetch
-
听起来文件是在将
NSFileProtection属性设置为NSFileProtectionComplete的情况下保存的。
标签: ios iphone objective-c lockscreen documentsdirectory