我正在尝试创建一个报亭应用程序,但是在尝试下载选定的 pdf 时,资产下载返回 nil。问题是什么?
-(void)downloadIssueAtIndex:(NSInteger)index
{
NKLibrary *nkLib = [NKLibrary sharedLibrary];
NKIssue *nkIssue = [nkLib issueWithName:[publisher nameOfIssueAtIndex:index]];
if (nkIssue == nil)
{
nkIssue = [nkLib addIssueWithName:[publisher nameOfIssueAtIndex:index] date:[NSDate date]];
}
if ([nkIssue status] != NKIssueContentStatusNone)
return;
NSLog(@"%@",nkIssue);
NSURL *downloadURL = [publisher contentURLForIssueWithName:nkIssue.name];
NSLog(@"%@",downloadURL);
if(!downloadURL) return;
NSURLRequest *req = [NSURLRequest requestWithURL:downloadURL];
NSLog(@"%@",req);
//req shows the correct url request
NKAssetDownload *assetDownload = [nkIssue addAssetWithRequest:req];
//assetDownload is nil
NSLog(@"%@",assetDownload);
[assetDownload setUserInfo:[NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt:index],@"Index",
nil]];
[assetDownload downloadWithDelegate:self];
}