0

我正在尝试创建一个报亭应用程序,但是在尝试下载选定的 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];
}
4

1 回答 1

0

我这个它返回 nil 因为[NKLibrary sharedLibrary];它也是。

也许您应该尝试将您的应用添加到报亭,方法是将 添加UINewsstandApp到您的 Info.plist 中,然后将其设置为YES.

于 2013-01-17T16:01:40.687 回答