【问题标题】:DropBox file download operation is not working on Background state with Passcode?DropBox 文件下载操作在使用密码的背景状态下不起作用?
【发布时间】:2014-03-07 11:18:10
【问题描述】:

如果我下载然后突然我用密码锁定 Iphone,下载进度会在几分之一秒内停止。 Dropbox 服务没有继续下载进度。

这里这个方法是用于下载操作。

-(void)downloadFile:(DBMetadata*)file
    {
        if (!file.isDirectory)
        {
           NSString *documentsPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];

           localPath = [documentsPath stringByAppendingPathComponent:file.filename];
           [[self restClientForDownload] loadFile:file.path intoPath:localPath];

        }

    }

【问题讨论】:

标签: ios objective-c dropbox-api


【解决方案1】:

您必须从主线程调用其余客户端方法。如果你从主线程开始连接,只需使用 GCD 在主线程上创建和启动连接 -

dispatch_async(dispatch_get_main_queue(), ^
{
NSURLConnection *downManager = [[NSURLConnection alloc] initWithRequest:request delegate:self startImmediately:YES];
[downManager start];
});

【讨论】:

    猜你喜欢
    • 2012-11-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-04-12
    • 2011-03-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多