BAD ACCESS Error

Discussion in 'iOS Programming' started by aceiswild, Nov 15, 2011.

  1. aceiswild macrumors newbie

    Joined:
    Nov 15, 2011
    Location:
    Canada
    #1
    Hey guys i have been working on this slider puzzle for about a week now. The project builds and runs fine until i click a square to move the puzzle piece and then the app crashes with the EXC_BAD_ACCESS error! I have tried everything i can think of and checked all my releases. Its driving me nuts!! It worked ok in Xcode 4.1/iOS 4, but Xcode 4.2 seems to not want it. If somebody could please take a look to see if all the releases are there or if their may be something else, please help me out. Much appreciated. Any questions, please ask. You can email me at sgmayer@telus.net

    Heres the code zipped up: http://www.mediafire.com/?1s50ml712mmw1i4

    Thanks,
    Steve
     
  2. xStep macrumors 68000

    Joined:
    Jan 28, 2003
    Location:
    Less lost in L.A.
    #2
    Use the analyzer; Menu-->Product-->Analyze

    I see via that, that you are releasing an object that you do not have a retain on. Specifically the following two lines do not balance because the first does not return a retained object.

    Code:
    UIImage *tileImage = [UIImage imageWithCGImage:tileImageRef];
    [tileImage release];
    I've attached a screen capture of a line the analyzer doesn't like. When you do this, click on the blue icon to the right of your code. Click the image below to see a larger version
     

    Attached Files:

  3. aceiswild thread starter macrumors newbie

    Joined:
    Nov 15, 2011
    Location:
    Canada
    #3
    Slider Puzzle exc_bad_access error

    Thank you a lot xStep! Ive had a headache with this since last week, and it was just that simple little error!! It's funny cause at one point i tinkered with that release but must have done something else as well!

    Very much appreciated !!

    Steve!
     
  4. xStep macrumors 68000

    Joined:
    Jan 28, 2003
    Location:
    Less lost in L.A.
    #4
    You are welcome.

    Did you run Analyze and find the two potential memory leaks?
     
  5. aceiswild thread starter macrumors newbie

    Joined:
    Nov 15, 2011
    Location:
    Canada
    #5
    Yes I did. I find it worked better then The Instruments tool because it basically pinpointed the cause. It works now without crashing! I wil work on the second leak when I get a chance but right now it's running fine!

    Thanks again
    Steve
     

Share This Page