NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:url]]; [request setTimeoutInterval:60.0f*5.0f ]; NKAssetDownload *assetDownload = [issue addAssetWithRequest:request];
addAssetWithRequestのrequestで指定しているURLが同じだと、exceptionがおこる模様。
2011-12-03 23:14:29.857 JalanMagazine[20034:11f03] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'there is already an assetDownload for this request ->
'
addAssetWithRequestするまえに、[issue downloadingAssets]でダウンロード中のURLを調べて、すでにダウンロード中ならaddしないようにすれば、回避できた
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:url]]; [request setTimeoutInterval:60.0f*5.0f ]; for (NKAssetDownload *assetDownload in [issue downloadingAssets]){ if ([assetDownload.URLRequest.URL isEqual:request.URL]){ return; } } NKAssetDownload *assetDownload = [issue addAssetWithRequest:request];