iOS:使用ZBarReaderViewController扫描选项时崩溃

时间:2014-04-18 18:23:44

标签: ios objective-c zbar-sdk zbar

我有一个主视图控制器,我有"扫描"按钮。我在这个主视图控制器的顶部启动了ZBarReaderViewController的扫描屏幕。一旦扫描成功,我将启动基于Cocos3d的场景视图,此时,主视图控制器和ZBarReaderViewController将被删除。我在Cocos3d场景中有一个后退选项。单击此返回选项,我将再次返回主视图控制器。再次,当我按扫描扫描条形码时,它崩溃了。我已经设置了NSZombieEnabled并添加了异常断点,但没有用,它在崩溃期间没有捕获任何东西。

这是我的代码流程:

·H:

@interface HOMyHomeMainMenuContoller : UIViewController <ZBarReaderDelegate>
{
     ZBarReaderViewController *codeReader;
}

的.m:

- (void)viewDidLoad
{
    [super viewDidLoad];

    // Do any additional setup after loading the view from its nib.
    codeReader = [ZBarReaderViewController new];

    codeReader.cameraDevice=UIImagePickerControllerCameraDeviceFront;
    codeReader.readerDelegate=self;
    codeReader.supportedOrientationsMask = ZBarOrientationMaskAll;
    codeReader.showsCameraControls = NO;  // for UIImagePickerController
    codeReader.showsZBarControls = NO;

    ZBarImageScanner *scanner = codeReader.scanner;
    [scanner setSymbology: ZBAR_I25 config: ZBAR_CFG_ENABLE to: 0];

    UIImage *overlayGraphic = [UIImage imageNamed:@"logo.jpg"];
    UIImageView *overlayGraphicView = [[UIImageView alloc] initWithImage:overlayGraphic];

    overlayGraphicView.transform= CGAffineTransformMakeRotation(M_PI/2);
    overlayGraphicView.frame = CGRectMake(0, 0, 768, 1024);
    [codeReader.view addSubview:overlayGraphicView];
    [overlayGraphicView release];

    UIImage *searchingImage = [UIImage animatedImageNamed:@"progress" duration:1.0f];;
    searchingImageView = [[UIImageView alloc] initWithImage:searchingImage];
    searchingImageView.frame = CGRectMake(350, 0, 70, 70);
    [codeReader.view addSubview:searchingImageView];
    [searchingImageView release];
    codeReader.cameraOverlayView = searchingImageView;
}

-(IBAction)myButton :(id)sender
{
    [self startScanning]; 
}

- (void) startScanning
{
    [self presentViewController:codeReader animated:YES completion:NULL]; 
}

任何人都可以帮助我,为什么再次发射时会崩溃?可能是由于ZBar代码中的内存问题?没有ZBar扫描,就没有崩溃。但是,我想要扫描功能。

提前谢谢你!

iPhone配置实用程序中打印出崩溃:

Apr 19 00:18:09 mycompcliLABiPAD2 MyApp[1369] <Warning>: Scanning..
Apr 19 00:18:09 mycompcliLABiPAD2 MyApp[1369] <Warning>: codeReader: <ZBarReaderViewController: 0x1e534390>
Apr 19 00:18:10 mycompcliLABiPAD2 kernel[0] <Debug>: AppleH4CamIn::setPowerStateGated: 1
Apr 19 00:18:10 mycompcliLABiPAD2 kernel[0] <Debug>: AppleH4CamIn::power_on_hardware
Apr 19 00:18:10 mycompcliLABiPAD2 kernel[0] <Debug>: AppleH4CamIn::ISP_SelectBestMIPIFrequencyIndex_gated - channel: 1, index: 0
Apr 19 00:18:10 mycompcliLABiPAD2 MyApp[1369] <Warning>: Received memory warning.
Apr 19 00:18:10 mycompcliLABiPAD2 com.apple.launchd[1] (UIKitApplication:com.apple.mobilemail[0xb71e][1321]) <Notice>: (UIKitApplication:com.apple.mobilemail[0xb71e]) Exited: Killed: 9
Apr 19 00:18:10 mycompcliLABiPAD2 com.apple.launchd[1] (com.apple.tccd[1331]) <Notice>: (com.apple.tccd) Exited: Killed: 9
Apr 19 00:18:10 mycompcliLABiPAD2 com.apple.launchd[1] (com.apple.coreservices.appleid.authentication[1378]) <Notice>: (com.apple.coreservices.appleid.authentication) Idle-exit job was jettisoned while dirty. Will respawn immediately.
Apr 19 00:18:10 mycompcliLABiPAD2 com.apple.launchd[1] (com.apple.coreservices.appleid.authentication[1378]) <Notice>: (com.apple.coreservices.appleid.authentication) Exited: Killed: 9
Apr 19 00:18:11 mycompcliLABiPAD2 com.apple.launchd[1] (UIKitApplication:com.mycomp.hOInsTestFronview[0xca93][1369]) <Notice>: (UIKitApplication:com.mycomp.hOInsTestFronview[0xca93]) Exited: Killed: 9
Apr 19 00:18:11 mycompcliLABiPAD2 UserEventAgent[13] <Notice>: jetsam: kernel termination snapshot being created
Apr 19 00:18:11 mycompcliLABiPAD2 backboardd[27] <Warning>: Application 'UIKitApplication:com.apple.mobilemail[0xb71e]' exited abnormally with signal 9: Killed: 9
Apr 19 00:18:11 mycompcliLABiPAD2 backboardd[27] <Warning>: Application 'UIKitApplication:com.mycomp.hOInsTestFronview[0xca93]' exited abnormally with signal 9: Killed: 9
Apr 19 00:18:11 mycompcliLABiPAD2 kernel[0] <Debug>: AppleH4CamIn::setPowerStateGated: 0
Apr 19 00:18:11 mycompcliLABiPAD2 kernel[0] <Debug>: AppleH4CamIn::power_off_hardware
Apr 19 00:18:11 mycompcliLABiPAD2 kernel[0] <Debug>: launchd[1384] Builtin profile: MobileMail (sandbox)
Apr 19 00:18:12 mycompcliLABiPAD2 ReportCrash[1383] <Error>: libMobileGestalt copySystemVersionDictionaryValue: Could not lookup ReleaseType from system version dictionary
Apr 19 00:18:12 mycompcliLABiPAD2 ReportCrash[1383] <Notice>: Saved crashreport to /Library/Logs/CrashReporter/LowMemory-2014-04-19-001812.plist using uid: 0 gid: 0, synthetic_euid: 0 egid: 0
Apr 19 00:18:13 mycompcliLABiPAD2 kernel[0] <Debug>: launchd[1385] Builtin profile: CommCenter (sandbox)
Apr 19 00:18:13 mycompcliLABiPAD2 CommCenterClassic[1385] <Error>: objc[1385]: Class CTPhoneNumber is implemented in both /System/Library/Frameworks/CoreTelephony.framework/CoreTelephony and /System/Library/Frameworks/CoreTelephony.framework/Support/CommCenterClassic. One of the two will be used. Which one is undefined.
Apr 19 00:18:13 mycompcliLABiPAD2 CommCenterClassic[1385] <Error>: libMobileGestalt copySystemVersionDictionaryValue: Could not lookup ReleaseType from system version dictionary
Apr 19 00:18:13 mycompcliLABiPAD2 CommCenterClassic[1385] <Error>: libMobileGestalt copySystemVersionDictionaryValue: Could not lookup ReleaseType from system version dictionary
Apr 19 00:18:13 mycompcliLABiPAD2 CommCenterClassic[1385] <Error>: libMobileGestalt copySystemVersionDictionaryValue: Could not lookup ReleaseType from system version dictionary
Apr 19 00:18:13 mycompcliLABiPAD2 CommCenterClassic[1385] <Error>: libMobileGestalt copySystemVersionDictionaryValue: Could not lookup ReleaseType from system version dictionary
Apr 19 00:18:14 mycompcliLABiPAD2 CommCenter[1385] <Error>: libMobileGestalt copySystemVersionDictionaryValue: Could not lookup ReleaseType from system version dictionary
Apr 19 00:18:14 mycompcliLABiPAD2 CommCenter[1385] <Error>: libMobileGestalt copySystemVersionDictionaryValue: Could not lookup ReleaseType from system version dictionary
Apr 19 00:18:14 mycompcliLABiPAD2 CommCenter[1385] <Error>: libMobileGestalt copySystemVersionDictionaryValue: Could not lookup ReleaseType from system version dictionary
Apr 19 00:18:14 mycompcliLABiPAD2 CommCenter[1385] <Notice>: Communications Center Started.
Apr 19 00:18:14 mycompcliLABiPAD2 awdd[1387] <Error>: libMobileGestalt copySystemVersionDictionaryValue: Could not lookup ReleaseType from system version dictionary
Apr 19 00:18:14 mycompcliLABiPAD2 awdd[1387] <Error>: CoreLocation: CLClient is deprecated. Will be obsolete soon.
Apr 19 00:18:17 mycompcliLABiPAD2 kernel[0] <Debug>: launchd[1390] Builtin profile: syncdefaultsd (sandbox)

0 个答案:

没有答案