I use ZBarReaderViewController
for scan QR Code. and it was perfectly worked on iOS 6.
But when i use iOS 7 with my project then it is not properly working with ZBarReaderViewController
Issue is related to memory, it take more then 100 MB and my device is hang at this time.
Generally in my project. user can scan QR Generator image and i have function which recognize code of QR code is related to my string which i got from server then if YES then i goes to next view controller otherwise remain in current (continue QR SCAN) screen.
If QR code mach with my string then on next screen has "cancel" button which make be scan another code ( it means i got to previous viewController (QR SCAN)).
At that time when i go to next viewController and back to pervious (QR Scan screen) then each time i got ZBarReaderViewController
is allocated so (May be) memory related issue is generated.
but i write code
if(self.ZBarReaderVC)
{
for(UIView *subVies in self.ZBarReaderVC.cameraOverlayView.subviews)
[subVies removeFromSuperview];
for(UIView *subVies in self.ZBarReaderVC.view.subviews)
[subVies removeFromSuperview];
[self.ZBarReaderVC removeFromParentViewController];
self.ZBarReaderVC = nil;
}
after [self.ZBarReaderVC dismissModalViewControllerAnimated: YES];
I remove ZBarReaderViewController
at the end time then why each time i got allocated ZBarReaderViewController
???
And also i put [self.ZBarReaderVC.readerView stop];
before dismiss ZBarReaderViewController
fro stop scanning stream of reader
but also it not worked for me.
But i tried to solve my problem about hours of time but i am not able to solve my issue
please help me.
Alos i found similar problem
Zbar SDK and ios7/xcode 5 - App is reaching 100% cpu use and memory more than 100MB
http://sourceforge.net/p/zbar/discussion/1072195/thread/df4c215a/
But No one can help me.
If you are targetting your app for iOS7 only, I ditched the ZBar component and used the native AVFoundation method, making the viewcontroller a AVCaptureMetadataOutputObjectsDelegate. Works prefectly with 3% CPU usage:
viewcontroller.h:
viewcontroller.m
I found that in
iOS 7
issue is occur atI put break point here and check whenever i come bake from previous viewController, its take more time and also memory (issue) at this code.
So first i need to remove view of
self.ZBarReaderVC
with its all subViews.. so at first i need to writeAnd also i got that in iOS 7
self.ZBarReaderVC
has remain continue scanning stream of QR Code so each time we need to stop it whenever your QR Code scanning is done and you need to dismiss yourself.ZBarReaderVC
then first stop scanning by[self.ZBarReaderVC.readerView stop];
And some time user need to write/call (For do/implement some type of extra features)
Methods of
self.ZBarReaderVC
then it is not need to use iniOS 7
, so if any user who call this methods ofself.ZBarReaderVC
then please put it in comment.I hope this my suggestion is helpful for others. Thanks :)