请指导一下路径。
NSIndexPath *index = [[self.collectionView indexPathsForSelectedItems]objectAtIndex:0];
_assetVersion = assetVer;
_bookPosition = [[bookList objectAtIndex:index.row]bookPosition];
_bookId = [[bookList objectAtIndex:index.row]bookID];
bookPath = [[bookList objectAtIndex:index.row]bookPath];
_downloadURLbook = [[bookList objectAtIndex:index.row]downloadURL];
NSLog(@"%@",_bookPosition);
cell.bookId = _bookId;
NSLog(@"%@",bookPath);
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
NSString *stringURL = [NSString stringWithFormat:@"http://powershelf-dev.3viewsolution.com/dhl/webservice/book_extract.php?main_menu=%@&language=%@&id=%@",_checkType,_checkLang,(_bookPosition)];
NSURLResponse *response = nil;
NSError *error = nil;
NSURL *url = [NSURL URLWithString:stringURL];
NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url];
NSURLConnection *urlConnection = [[NSURLConnection alloc]init];
NSData *data = [NSURLConnection sendSynchronousRequest:urlRequest returningResponse:&response error:&error];
[self connection:urlConnection didReceiveResponse:response];
[self connection:urlConnection didReceiveData:data];
dispatch_async(dispatch_get_main_queue(), ^{
//code for check data
});
});
我不知道这个为什么总是像这样崩溃
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[DownloadedBookDetail bookPosition]: unrecognized selector sent to instance 0x146cf4a0'
但是,当我使用来自网络服务的图像时,它是有效的。如果我使用bookIndex = indexPath;
没有代码
NSIndexPath *index = [[self.collectionView indexPathsForSelectedItems]objectAtIndex:0];
_assetVersion = assetVer;
_bookPosition = [[bookList objectAtIndex:index.row]bookPosition];
_bookId = [[bookList objectAtIndex:index.row]bookID];
bookPath = [[bookList objectAtIndex:index.row]bookPath];
_downloadURLbook = [[bookList objectAtIndex:index.row]downloadURL];
它也会起作用。但我需要使用来自数据库检查数据的数据和Web服务。
我需要将bookIndex = indexPath;
与Web服务一起使用
我去看看这个
if([db isDownloaded:bookName bookVersion:[bookVersion floatValue]]){
[self performSegueWithIdentifier:@"reader" sender:self];
}
else{
[self startDownload];
}
感谢任何想法。