我目前正在创建iOS报亭应用.我添加了问题并以我想要的方式工作.但是,当我尝试去下载他们的远程文件时,它似乎不起作用.没有调用任何委托方法,也没有写入任何文件.
这是我肯定的:
当用户同意下载问题时,会发生以下代码(注意:问题不是零):
// Download the Issue!
NSLog(@"Starting Download of issue %@",issue.name);
// Generate the url of the issue
NSURL * downloadURL = [dataManager pdfURLForIssue:issue];
// Create the request
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:downloadURL
cachePolicy:NSURLRequestReloadIgnoringLocalAndRemoteCacheData
timeoutInterval:30.0];
// Create the NKAssetDownload object
NKAssetDownload *assetDownload = [issue addAssetWithRequest:request];
// Set user info so I know which issue's UIProgressView to update
[assetDownload setUserInfo:[NSDictionary dictionaryWithObjectsAndKeys:issue.name,@"Name",
nil]];
// start download
[assetDownload downloadWithDelegate:self];
Run Code Online (Sandbox Code Playgroud)
我不知道发生了什么事.从我读过的所有内容来看,我似乎已经正确地实现了一切; 然而,一切都没有发生.我设置断点,NSLogs等; 但没什么.我甚至让它运行一段时间然后检查导演[问题contentURL]说文件也会被移动(在我的connectionDidFinishDownloading:destinationURL:方法中).
有人可以帮忙吗?或许对我来说有些想法?我被困了几天.如果您需要查看更多代码,请告诉我们.谢谢!