Zbar SDK and ios7/xcode 5 - App is reaching 100% cpu use and memory more than 100MB

前端 未结 6 956
我寻月下人不归
我寻月下人不归 2020-12-28 09:48

We are using Zbar bar code reader from last 2 years. With iOS 7 and Xcode 5, after scanning 5 bar codes the app is reaching 100 % cpu use for iOS 7 device(I can see that in

6条回答
  •  一生所求
    2020-12-28 09:54

    Solved doing this: in the viewdidload

    readerqr = [ZBarReaderViewController new];
        readerqr.readerDelegate = self;
        readerqr.showsHelpOnFail = NO;
    
    ZBarImageScanner *scanner = readerqr.scanner;
    [scanner setSymbology: 0
                   config: ZBAR_CFG_ENABLE
                       to: 0];
    [scanner setSymbology: ZBAR_QRCODE
                   config: ZBAR_CFG_ENABLE
                       to: 1];
    
    // you can use this to support the simulator
    if(TARGET_IPHONE_SIMULATOR) {
        cameraSim = [[ZBarCameraSimulator alloc]
                     initWithViewController: self];
        cameraSim.readerView = readerView;
    }
    

    create ZBarReaderViewController *readerqr; as a property of your viewcontroller.

    to use it:

    -(void) showqr:(id)sender
    {
        [self presentViewController:readerqr animated:YES completion:nil];
        return;
    }
    

    This way works, no leak, no cpu 100%

提交回复
热议问题