Zbar bad access..

Discussion in 'iOS Programming' started by IDMah, Jun 7, 2012.

  1. IDMah, Jun 7, 2012
    Last edited: Jun 7, 2012

    IDMah macrumors 6502

    IDMah

    Joined:
    May 13, 2011
    #1
    I tried to run zbar with a view. which didn't work..
    Code:
    
    // ala this..
    - (void) viewDidLoad
    {
        [super viewDidLoad];
        
        reader = [[ZBarReaderViewController alloc] init];
        
        reader.readerDelegate = self;
        reader.showsZBarControls = NO;
        reader.supportedOrientationsMask = ZBarOrientationMaskAll;
        
        ZBarImageScanner *scanner = reader.scanner;
        
        [scanner setSymbology: 0
                       config: ZBAR_CFG_ENABLE
                           to: 0];
        
        [scanner setSymbology: ZBAR_QRCODE
                       config: ZBAR_CFG_ENABLE
                           to: 1];
        
        reader.readerView.frame = CGRectMake(self.view.frame.size.width* 0.015,self.view.frame.size.height*0.05375,
                                             self.view.frame.size.width *0.965625, 350);
        // 309, 350 //
        
        reader.readerView.alpha = 0.5;
        
        [self.view addSubview:reader.readerView];
        
    }
    
    but now I get a Thread 1:EXC_BAD_ACESSS (code=2, address=0x17)
    in this: libobjc.A.dylib`_ZL12realizeClassP7class_t:
    and libobjc.A.dylib`_class_lookupMethodAndLoadCache3:

    even after changing everything back.. tried cleaning.
    tried rebooting simulator. exiting and restarting Xcode..
    Not sure where things are mucking up???

    HELP !!! :confused:

    thanks
    Ian


    ps. It was running fine last night. Compiled clean.. the only thing I added and then deleted was the above code..
     
  2. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #2
    Is zbar built from a sub-project? Do you have the -ObjC linker flag set?
     
  3. waterskier2007 macrumors 68000

    waterskier2007

    Joined:
    Jun 19, 2007
    Location:
    White Lake, MI
    #3
    Why did you decide to run it this way. Why not have it load up when you hit a button or some other sort of action? That's the way I have it set up and it works fine. Something worth noting however, is that for a while I could not get it to work. I was in one of the Dev builds of XCode 4.4 and then I upgraded to the 3rd preview and it started working.
     
  4. IDMah, Jun 8, 2012
    Last edited: Jun 8, 2012

    IDMah thread starter macrumors 6502

    IDMah

    Joined:
    May 13, 2011
    #4
    sort of fixed by giving up hahaaa !!!!

    Hi WaterSkier I was trying to do that.. do you have an example?
    obviously the example I found was not great..

    I want to keep the app as "mom" proof as possible,camera screen confuses my mom.
    So would like Zbar to live on a NSView Which says .. "Please scan QR code. "
    Above the Zbar (live video) screen (CameraView) .. With an overlay of a
    QR Code to be extra "mom" proof.

    I think I did manage to fix it. buy Reverting back to previous code.
    and I dropped the ZBar in to project so it's just a library. Not Sub-project.
    but thanks.. Using Xcode 4.3.2 release..

    thanks
    Ian

    ps. that said getting a "Thread 1 SIGTRAP" error when I run on iPad simulator.. ugh!
     

Share This Page