Zbar SDK和ios7 / xcode 5 - 应用程序的CPU使用率达到100%,内存超过100MB [英] Zbar SDK and ios7/xcode 5 - App is reaching 100% cpu use and memory more than 100MB
问题描述
我们正在使用过去2年的Zbar条形码阅读器。使用iOS 7和Xcode 5,扫描5个条形码后,应用程序达到了iOS 7设备的100%cpu使用率(我可以在Xcode调试模式下看到),应用程序的响应速度也会降低。我们从未在早期的iOS版本中遇到问题,一切正常。
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 Xcode debug mode) and app become less responsive. We never had issue in earlier iOS versions, everything worked fine.
iOS 7中与相机启动有关的事情是否有所改变且ZBar SDK未更新? iOS 7中是否有其他人面临同样的问题?
Is thing changed in iOS 7 related to camera launching and ZBar SDK is not updated? Is anyone else facing same issue with iOS 7?
推荐答案
解决了这个问题: 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;
}
创建 ZBarReaderViewController * readerqr;
作为viewcontroller的属性。
create ZBarReaderViewController *readerqr;
as a property of your viewcontroller.
使用它:
-(void) showqr:(id)sender
{
[self presentViewController:readerqr animated:YES completion:nil];
return;
}
这种方式有效,无泄漏,无cpu 100%
This way works, no leak, no cpu 100%
这篇关于Zbar SDK和ios7 / xcode 5 - 应用程序的CPU使用率达到100%,内存超过100MB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!