Skip to main content

EXC_BAD_ACCESS when opening modal view



I'm having a problem with my iPhone App, I'm getting EXC_BAD_ACCESS, I had some memory leaks, but these are now fixed, so I'm not sure whats going on. I realise that I haven't provide a lot of information, but I really don't know whats happening.





The initial screen opens up where I have a number of buttons. Tapping on the first button, which runs the following code and opens up a modal view:







-(IBAction)newWorkoutButton

{

newWorkoutViewController .loadedFromRootViewController = @"YES";

[self presentModalViewController:newWorkoutViewController animated:YES];

}







The screen freezes and the is in the code below:







#import <UIKit/UIKit.h>

#import <objc/runtime.h>

#import <CoreLocation/CoreLocation.h>





int main(int argc, char *argv[])

{

Method getDistanceFrom = class_getInstanceMethod([CLLocation class], @selector(getDistanceFrom:));

class_addMethod([CLLocation class], @selector(distanceFromLocation:), method_getImplementation(getDistanceFrom), method_getTypeEncoding(getDistanceFrom));



NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

int retVal = UIApplicationMain(argc, argv, nil, nil); // ERROR HAPPENING HERE

[pool release];

return retVal;

}




Comments

  1. Like Aleks suggested you can try to find the zombie like this:

    I find this alternative more convenient:


    Click the "Run Button Dropdown"
    From the list choose Profile
    The program "Instruments" should open where you can also choose Zombies
    Now you can interact with your app and try to cause the error
    As soon as the error happens you should get a hint on when your object was released and therefore deallocated.

    ReplyDelete

Post a Comment

Popular posts from this blog

Why is this Javascript much *slower* than its jQuery equivalent?

I have a HTML list of about 500 items and a "filter" box above it. I started by using jQuery to filter the list when I typed a letter (timing code added later): $('#filter').keyup( function() { var jqStart = (new Date).getTime(); var search = $(this).val().toLowerCase(); var $list = $('ul.ablist > li'); $list.each( function() { if ( $(this).text().toLowerCase().indexOf(search) === -1 ) $(this).hide(); else $(this).show(); } ); console.log('Time: ' + ((new Date).getTime() - jqStart)); } ); However, there was a couple of seconds delay after typing each letter (particularly the first letter). So I thought it may be slightly quicker if I used plain Javascript (I read recently that jQuery's each function is particularly slow). Here's my JS equivalent: document.getElementById('filter').addEventListener( 'keyup', function () { var jsStart = (new Date).getTime()...

Is it possible to have IF statement in an Echo statement in PHP

Thanks in advance. I did look at the other questions/answers that were similar and didn't find exactly what I was looking for. I'm trying to do this, am I on the right path? echo " <div id='tabs-".$match."'> <textarea id='".$match."' name='".$match."'>". if ($COLUMN_NAME === $match) { echo $FIELD_WITH_COLUMN_NAME; } else { } ."</textarea> <script type='text/javascript'> CKEDITOR.replace( '".$match."' ); </script> </div>"; I am getting the following error message in the browser: Parse error: syntax error, unexpected T_IF Please let me know if this is the right way to go about nesting an IF statement inside an echo. Thank you.