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

Slow Android emulator

I have a 2.67 GHz Celeron processor, 1.21 GB of RAM on a x86 Windows XP Professional machine. My understanding is that the Android emulator should start fairly quickly on such a machine, but for me it does not. I have followed all instructions in setting up the IDE, SDKs, JDKs and such and have had some success in staring the emulator quickly but is very particulary. How can I, if possible, fix this problem?