I want to create application for Scan Books barcode , but when I can scan barcode successfully , then ZBarReaderViewController not dismiss in imagePickerController didFinishPickingMediaWithInfo delegate and I getting warning :
Warning: Attempt to dismiss from view controller while a presentation or dismiss is in progress!
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
id<NSFastEnumeration> results = [info objectForKey: ZBarReaderControllerResults];
ZBarSymbol *symbol = nil;
for(symbol in results)
// EXAMPLE: just grab the first barcode
break;
// EXAMPLE: do something useful with the barcode data
resultLable.text = symbol.data;
isbnResultString=symbol.data;
NSLog(@"isbnResultString-----%@",isbnResultString);
isbnLableText.text=isbnResultString;
NSLog(@"%@",[info objectForKey: UIImagePickerControllerOriginalImage]);
// EXAMPLE: do something useful with the barcode image
barCodeImageView.image=[info objectForKey: UIImagePickerControllerOriginalImage];
// ADD: dismiss the controller (NB dismiss from the *reader*!)
[self dismissViewControllerAnimated:YES completion:nil];
if (isbnResultString.length!=0)
{
if(![self connectedToInternet])
{
[appDelagate showActivityIndicator];
appDelagate.isNetConnected=NO;
[self internetAlert];
}
else
{
[self getBookDetailsByISBN:symbol.data];
}
}
}
How to dismiss ZBarReaderViewController?