2012-10-26 64 views
1

我正在使用NewsstandKit.frame工作来开发应用程序。 有是NKAssetDownload要求:我取消NKAsset时无法启动应用程序下载

NSURLRequest *request = [[NSURLRequest alloc]initWithURL:url cachePolicy:NSURLRequestReturnCacheDataElseLoad timeoutInterval:5.0]; 
    _assetDownload = [self.issue addAssetWithRequest:request]; 
    [_assetDownload downloadWithDelegate:self]; 

我停止方式/暂停下载它取消连接:

NSURLConnection *con = [[self.issue.downloadingAssets objectAtIndex:0] downloadWithDelegate:self]; 
    [con cancel]; 

再有成为问题,当我再次运行应用程序,会有显示有关错误的信息:

- [NKAssetDownload封面]:无法识别的选择发送到实例0x6c69fc0 2012年10月26日15:49:39.257 MyMagazineDemoV0.0.1 [3872:FB03] *期限inating应用程序由于未捕获的异常 'NSInvalidArgumentException',原因是: ' - [NKAssetDownload封面]:无法识别的选择发送到实例0x6c69fc0' *第一掷调用堆栈: (0x18b1022 0x1a42cd6 0x18b2cbd 0x1817ed0 0x1817cb2 0x10405 0x1018d 0x12f0a 0x127f8 0x3a2a 0x3d999b 0x338401 0x338a46 0x254e 0x310386 0x311274 0x320183 0x320c38 0x314634 0x179bef5 0x1885195 0x17e9ff2 0x17e88da 0x17e7d84 0x17e7c9b 0x310c65 0x312626 0x2292 0x2205) 终止叫做抛出异常

我duno WUT意思,因为我无法找到NKAssetDownload称为 “盖” 的方法。 任何人可以帮我:)

回答

0

正确的步骤即可开始下载如下:

currentIssue = [库addIssueWithName:issueName日期:issueDate];

NSURLRequest * urlReq = [NSURLRequest requestWithURL:[NSURL URLWithString:file_Url]]; NKAssetDownload * asset = [currentIssue addAssetWithRequest:urlReq]; [资产下载withDelegate:self];

如果要删除的问题,你也应该从书报亭库中删除的问题:

NKIssue *issueToRemove = [[NKLibrary sharedLibrary] issueWithName:issueName]; 
if (issueToRemove) { 
    [[NKLibrary sharedLibrary] removeIssue:issueToRemove]; 
} 

除此之外u必须实现NSURLConnectionDownloadDelegate方法

  • (无效)连接:(NSURLConnection *)连接didWriteData :(long long)bytesWritten totalBytesWritten:(long long)totalBytesWritten expectedTotalBytes:(long long)expectedTotalBytes

  • (无效)connectionDidFinishDownloading:(NSURLConnection的*)连接DESTINATIONURL:(NSURL *)DESTINATIONURL

试试这个。这工作没有错误。

相关问题