2015-04-08 2 views
0

Я пытаюсь добавить RedLaser SDK в мой проект, и при попытке открыть PickerController я получаю сообщение об ошибке по адресу:Не удается найти причину аварии

0x39b70538: push {r4, r5, r6, r7, lr}.

Это код, как я экземпляр PickerController: метод

- (IBAction) redBoxScanButtonPressed 
{ 
    RLSampleViewControllerRequestVideoAuthorization(^void (void) { 

     RedBoxPickerController *redBoxPickerController = 
     [[RedBoxPickerController alloc] initWithNibName:@"RedBoxPickerController" bundle:nil]; 
     redBoxPickerController.delegate = self; 

     // hide the status bar and show the scanner view 
     [[UIApplication sharedApplication] setStatusBarHidden:YES]; 
     [self presentViewController:redBoxPickerController animated:NO completion:nil];// presentModalViewController:redBoxPickerController animated:FALSE]; 
     //[redBoxPickerController release]; 
    }); 
} 

просить разрешения:

static void RLSampleViewControllerRequestVideoAuthorization(dispatch_block_t completionHandler) { 

    RL_RequestVideoAuthorization(^void (RL_VideoAuthorizationStatus status) { 

     if (status == RL_VideoAuthorizationStatusAuthorized) { 

      dispatch_async(dispatch_get_main_queue(), ^void (void) { 

       completionHandler(); 

      }); 

     } 

    }); 

} 

трассировку

(lldb) bt 
* thread #11: tid = 0xc81db, 0x39b70538 libc++abi.dylib`__cxa_throw, queue = 'ZXing', stop reason = breakpoint 1.2 * frame #0: 0x39b70538 libc++abi.dylib`__cxa_throw 
    frame #1: 0x00187e32 IRON TRAINERS`zxing::GlobalHistogramBinarizer::estimate(std::vector<int, std::allocator<int> >&) + 370 
    frame #2: 0x00187f60 IRON TRAINERS`zxing::GlobalHistogramBinarizer::getBlackMatrix() + 268 
    frame #3: 0x00186580 IRON TRAINERS`zxing::BinaryBitmap::getBlackMatrix() + 12 
    frame #4: 0x001a9b00 IRON TRAINERS`zxing::qrcode::QRCodeReader::decode(zxing::Ref<zxing::BinaryBitmap>, zxing::DecodeHints) + 44 
    frame #5: 0x001b086e IRON TRAINERS`zxing::Reader::decode(zxing::Ref<zxing::BinaryBitmap>) + 278 
    frame #6: 0x001b4a86 IRON TRAINERS`-[FormatReader decode:] + 142 
    frame #7: 0x00185da8 IRON TRAINERS`-[ZXingDecoder findCodesInBitmap:bytesPerRow:width:height:] + 796 
    frame #8: 0x001ba93e IRON TRAINERS`-[BarcodePhotoEngine zxingFindBarcodesInPixmap:] + 226 
    frame #9: 0x001b318c IRON TRAINERS`__38-[BarcodeEngine findBarcodesInPixMap:]_block_invoke55 + 76 
    frame #10: 0x0081e172 libdispatch.dylib`_dispatch_call_block_and_release + 10 
    frame #11: 0x00826d66 libdispatch.dylib`_dispatch_queue_drain + 1718 
    frame #12: 0x00820a60 libdispatch.dylib`_dispatch_queue_invoke + 88 
    frame #13: 0x00828b08 libdispatch.dylib`_dispatch_root_queue_drain + 1308 
    frame #14: 0x00829e18 libdispatch.dylib`_dispatch_worker_thread3 + 100 
    frame #15: 0x3a91adc0 libsystem_pthread.dylib`_pthread_wqthread + 668 (lldb) 

Я не уверен, что искать , Я попытался добавить несколько breakpoints, но не нашел проблему.

Образец проекта отлично работает, поэтому, я думаю, мне не хватает кода.

Вот полный код PickerController:

/******************************************************************************* 
    RedBoxPickerController.m 
    Part of RLSample 

    This is a scan overlay example that frames discovered barcodes with red boxes. 

    Chall Fry 
    November 2012 
    Copyright (c) 2012 eBay Inc. All rights reserved. 
*/ 

#import "RedBoxPickerController.h" 


@implementation RedBoxPickerController 

/******************************************************************************* 
    didReceiveMemoryWarning 

*/ 
- (void) didReceiveMemoryWarning 
{ 
    [super didReceiveMemoryWarning]; 
} 

/******************************************************************************* 
    viewWillAppear: 

    Sets up the initial state of UI elements in the overlay. 
*/ 
- (void) viewWillAppear:(BOOL)animated 
{ 
    [super viewWillAppear:animated]; 

    inRangeLabel.hidden = true; 
    numBarcodesFoundLabel.text = @""; 

    torchButton.enabled = self.hasTorch; 
    torchButton.style = self.isTorchOn ? UIBarButtonItemStyleDone : 
      UIBarButtonItemStyleBordered; 
} 

#pragma mark Button Handlers 

/******************************************************************************* 
    cancelScan 

    Action proc for the 'Done' button. 
*/ 
- (IBAction) cancelScan 
{ 
    [self doneScanning]; 
} 

/******************************************************************************* 
    captureImage 

    Action proc for the 'Cap' button. 
    Need to have reportCameraImage enabled for this. 
*/ 
- (IBAction) captureImage 
{ 
    if (!imageSaveInProgress) 
    { 
     [self requestCameraSnapshot:true]; 
     savingImageLabel.hidden = false; 
     captureButton.enabled = false; 
    } 
} 

/******************************************************************************* 
    toggleFrontBackCamera 

    Action proc for the 'Front/Back' button. 
*/ 
- (IBAction) toggleFrontBackCamera 
{ 
    self.useFrontCamera = !self.useFrontCamera; 
} 

/******************************************************************************* 
    toggleTorch 

    Action proc for the 'Light' button. 
*/ 
- (IBAction) toggleTorch 
{ 
    [self turnTorch:!self.isTorchOn]; 
    torchButton.style = self.isTorchOn ? UIBarButtonItemStyleDone : 
      UIBarButtonItemStyleBordered; 
} 

#pragma mark Status Updates 

/******************************************************************************* 
    statusUpdated: 

    The RedLaser SDK will call this method repeatedly while scanning for barcodes. 
*/ 
- (void) statusUpdated:(NSDictionary*) status 
{ 
    NSSet *foundBarcodes = [status objectForKey:@"FoundBarcodes"]; 

    // Report how many barcodes we've found so far 
    numBarcodesFoundLabel.text = [NSString stringWithFormat:@"%d Barcodes found", 
      [foundBarcodes count]]; 

    // Show the right guidance string for the guidance level 
    // Guidance is used for detecting long Code 39 codes in parts. 
    // See the documentation for more info. 
    int guidanceLevel = [[status objectForKey:@"Guidance"] intValue]; 
    if (guidanceLevel == 1) 
    { 
     guidanceLabel.text = @"Try moving the camera close to each part of the barcode"; 
    } else if (guidanceLevel == 2) 
    { 
     guidanceLabel.text = [NSString stringWithFormat:@"%@…", 
       [status objectForKey:@"PartialBarcode"]]; 
    } else { 
     guidanceLabel.text = @""; 
    } 

    // Show the in range label if we're in range of an EAN barcode 
    inRangeLabel.hidden = ![[status objectForKey:@"InRange"] boolValue]; 

    // Tell the Red Box View to update its display 
    redBoxView.barcodes = foundBarcodes; 
    [redBoxView setNeedsDisplay]; 

    // If the user clicked the "Capture" button, this key will have a UIImage in it 
    // on a subsequent statusUpdated call. Otherwise, the key won't be present. 
    // If we have a camera image, save it to the device's photo album. 
    UIImage *cameraImage = [status objectForKey:@"CameraSnapshot"]; 
    if (cameraImage && cameraImage != (id) [NSNull null]) 
    { 
     imageSaveInProgress = true; 

     UIImageWriteToSavedPhotosAlbum(cameraImage, self, 
       @selector(image:didFinishSavingWithError:contextInfo:), nil); 
    } 
} 

/******************************************************************************* 
    image:didFinishSavingWithError:contextInfo: 

    Called when UIImageWriteToSavedPhotosAlbum() has finished saving an image to 
    the camera roll. 

    Reenables the Capture button and hides the "Saving Image..." label. 
*/ 
- (void) image: (UIImage *) image didFinishSavingWithError: (NSError *) error 
     contextInfo: (void *) contextInfo 
{ 
    imageSaveInProgress = false; 
    savingImageLabel.hidden = true; 
    captureButton.enabled = true; 
} 

@end 

@implementation RedBoxView 

@synthesize barcodes; 

/******************************************************************************* 
    drawRect: 

    RedBoxView is a UIView subclass that exists to override this method. 

    When it redraws itself, it looks for any barcodes in the found barcode set that 
    have been 'seen' in the last second, makes a UIBezierPath from the corner 
    locations of the barcode, and then fills and strokes the path. 
*/ 
- (void) drawRect:(CGRect)rect 
{ 
    for (BarcodeResult *val in self.barcodes) 
    { 
     // Has this barcode been seen on-screen recently, or is it stale? 
     if ([val.mostRecentScanTime timeIntervalSinceNow] < -1.0) 
     { 
      continue; 
     } 

     // Don't bother displaying a path that only has 2 points--this is rare but can happen 
     if ([val.barcodeLocation count] < 2) 
      continue; 

     // Generate a UIBezierPath of the points, close it, and fill it 
     UIBezierPath *path = [UIBezierPath bezierPath]; 
     [path moveToPoint:[[val.barcodeLocation objectAtIndex:0] CGPointValue]]; 
     for (int index = 1; index < [val.barcodeLocation count]; ++index) 
     { 
      [path addLineToPoint:[[val.barcodeLocation objectAtIndex:index] CGPointValue]]; 
     } 
     [path closePath]; 

     [[UIColor colorWithRed:1.0 green:0.0 blue:0.0 alpha:0.2] set]; 
     [path fill]; 

     [[UIColor colorWithRed:1.0 green:0.0 blue:0.0 alpha:0.3] set]; 
     [path stroke]; 
    } 

    // Be sure to clear out the barcodes once we've drawn them 
    self.barcodes = nil; 
} 

- (void) didMoveToSuperview 
{ 
    CGRect superviewFrame = [[self superview] frame]; 
    superviewFrame.origin.x = superviewFrame.origin.y = 0; 
    self.frame = superviewFrame; 
    [super didMoveToSuperview]; 
} 


@end 

ответ

1

Вы можете «Включить зомби объекты» в вас схеме приложения. Это даст вам правильные сообщения об ошибках.

Просто нажмите на название вашего приложения (Правая сторона кнопки остановки на xCode), затем нажмите «Редактировать схему», затем нажмите «RUN» в левой панели. Перейдите на вкладку «Диагностика» там, где вы увидите заголовок «Управление памятью», под которым вы можете включить Msgstr "Включить объекты зомби".

Надеюсь, это вам поможет.

+0

Спасибо, это хороший совет, хотя он не показал мне никакого сообщения. – Jorge

Смежные вопросы