VivekVithlani / QRCodeReader

QRCodeReader with V3QRCodeReaderFramework
https://ioshelloworld.blogspot.com
19 stars 8 forks source link

Need to stop reading #1

Open Parkyprg opened 7 years ago

Parkyprg commented 7 years ago

Good job with this reader.

However, there only a method to start reading, but not to stop. I am using it in a UITabBarController and if I change the tab, it will still read. I need to stop it when the view disappears.

Thank you

VivekVithlani commented 7 years ago

Thank you for using my framework.

You need to remove [qrCodeView startReading]; method from "M2" QRCodeReaderDelegate method.

i.e. `- (void)getQRCodeData:(id)qRCodeData { UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"QR Code" message:qRCodeData preferredStyle:UIAlertControllerStyleAlert];

UIAlertAction *cancel = [UIAlertAction actionWithTitle:@"Close" style:UIAlertActionStyleDefault handler:nil]; [alertController addAction:cancel];

UIAlertAction reScan = [UIAlertAction actionWithTitle:@"Rescan" style:UIAlertActionStyleDefault handler:^(UIAlertAction _Nonnull action) {

[qrCodeView startReading]; // Remove this line

}]; [alertController addAction:reScan]; [self presentViewController:alertController animated:YES completion:nil]; }`

When the view disappears you need to put this code qrCodeView = nil;

If you still facing any issue or any scenario please let me know, Thank you.

Parkyprg commented 7 years ago

Thank you for your reply. However, this is not helping too much. Consider this scenario: I have a UITabBarController and one of the UIViewControllers have this QRCode reader. If I switch between controllers, I have to stop reading codes, otherwise, even if the page is not active, the codes are still scanned.

I got this working by destroying the component when the view will disappear.

But unfortunately I had to use a different framework, because this was build only for arm64 architecture and I needed for armv7 and armv7s too and there was no reply from your side for some time.

VivekVithlani commented 7 years ago

Ok