2012-10-26 62 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

試試這個。這工作沒有錯誤。

相關問題