0

我正在使用适用于 iOS 的 Scandit phonegap-plugins https://github.com/Scandit/BarcodeScannerPlugin。但是在点击屏幕上的扫描按钮后,它崩溃并显示错误:程序在这一行收到信号 EXC_BAD_ACCESS [self.viewController presentViewController:scanditSDKBarcodePicker animated:YES completion:^{ of the following code

    if ([self.viewController respondsToSelector:@selector(presentViewController:animated:completion:)]) {
    [self.viewController presentViewController:scanditSDKBarcodePicker animated:YES completion:^{
        startAnimationDone = YES;
        if (self.bufferedResult != nil) {
            [self scanditSDKOverlayController:scanditSDKBarcodePicker.overlayController
                               didScanBarcode:self.bufferedResult];
            self.bufferedResult = nil;
        }
    }];
} else {
    [self.viewController presentModalViewController:scanditSDKBarcodePicker animated:NO];
    startAnimationDone = YES;
}

[scanditSDKBarcodePicker performSelector:@selector(startScanning) withObject:nil afterDelay:0.1];
[scanditSDKBarcodePicker release];}

这是回溯

#0  0x0253009f in objc_msgSend ()
#1  0x00000001 in ?? ()
#2  0x0251ab70 in objc_setProperty ()
#3  0x00180870 in -[UIViewControllerAction setCompletion:] ()
#4  0x00189c4c in -[UIViewController presentViewController:withTransition:completion:] ()
#5  0x0018a58c in -[UIViewController presentViewController:animated:completion:] ()
#6  0x095a6280 in -[UIViewControllerAccessibility(SafeCategory)              presentViewController:animated:completion:] ()
#7  0x0000786b in -[ScanditSDK scan:withDict:] (self=0xe00aad0, _cmd=0x5b0f6,  arguments=0xe026e90, options=0xe026f60) at /Users/Elevate/Projects/phonegap-plugins-master/iOS/BarcodeScanner/Example/BarCodeScannerCDV/BarCodeScannerCDV/ScanditSDK.mm:340
#8  0x0238dec9 in -[NSObject performSelector:withObject:withObject:] ()
#9  0x0001bf30 in -[CDVViewController execute:] ()
#10 0x00003883 in -[AppDelegate execute:] (self=0x8722a50, _cmd=0x5a395, command=0xe026e60) at /Users/Elevate/Projects/phonegap-plugins-master/iOS/BarcodeScanner/Example/BarCodeScannerCDV/BarCodeScannerCDV/Classes/AppDelegate.m:145
#11 0x0001bc58 in -[CDVViewController executeQueuedCommands] ()
#12 0x0001bd2e in -[CDVViewController flushCommandQueue] ()
#13 0x0001af22 in -[CDVViewController webView:shouldStartLoadWithRequest:navigationType:] ()
#14 0x00003b5f in -[AppDelegate webView:shouldStartLoadWithRequest:navigationType:] (self=0x8722a50, _cmd=0x5a424, theWebView=0x9212760, request=0x9231580, navigationType=UIWebViewNavigationTypeOther) at /Users/Elevate/Projects/phonegap-plugins-master/iOS/BarcodeScanner/Example/BarCodeScannerCDV/BarCodeScannerCDV/Classes/AppDelegate.m:183
#15 0x002738d4 in -[UIWebView webView:decidePolicyForNavigationAction:request:frame:decisionListener:] ()
#16 0x0027559e in -[UIWebViewWebViewDelegate webView:decidePolicyForNavigationAction:request:frame:decisionListener:] ()
#17 0x022f251d in __invoking___ ()
#18 0x022f2437 in -[NSInvocation invoke] ()
#19 0x0231d49a in -[NSInvocation invokeWithTarget:] ()
#20 0x02b82aa4 in -[_WebSafeForwarder forwardInvocation:] ()
#21 0x022f30c9 in ___forwarding___ ()
#22 0x022f2ce2 in __forwarding_prep_0___ ()
#23 0x022f251d in __invoking___ ()
#24 0x022f2437 in -[NSInvocation invoke] ()
#25 0x03722ae3 in SendMessage ()
#26 0x03723115 in HandleDelegateSource ()
#27 0x0236097f in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ ()
#28 0x022c3b73 in __CFRunLoopDoSources0 ()
#29 0x022c3454 in __CFRunLoopRun ()
#30 0x022c2db4 in CFRunLoopRunSpecific ()
#31 0x022c2ccb in CFRunLoopRunInMode ()
#32 0x02275879 in GSEventRunModal ()
#33 0x0227593e in GSEventRun ()
#34 0x000bda9b in UIApplicationMain ()
#35 0x00002b36 in main (argc=1, argv=0xbfffecb0) at /Users/Elevate/Projects/phonegap-plugins-master/iOS/BarcodeScanner/Example/BarCodeScannerCDV/BarCodeScannerCDV/main.m:32
#36 0x00002aa5 in start ()
4

1 回答 1

0

你实例化了scanditSDKBarcodePicker某个地方吗?

我认为您应该执行以下操作:

ScanditSDKBarcodePicker picker  = [[ScanditSDKBarcodePicker alloc] init];

然后像这样使用它:

[self.viewController presentViewController:picker animated:YES....
于 2013-08-01T13:21:09.507 回答