[UIButton retain]: message sent to deallocated instance on device but not on simulator

274 views Asked by At

I have the above error message on device but not on simulator - here it plays normally.

Here is my code :

- (void)loadView {
    NSLog(@"loadView");
    self.scrollView = [[UIScrollView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
    self.scrollView.delegate = self;
    self.scrollView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"backgroundLeather.png"]];
    self.view = self.scrollView;
}

- (void)viewDidLoad {
    [super viewDidLoad];

    NSLog(@"viewDidLoad is called");

    // add cancel / done button

    self.cancelButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    [self.cancelButton addTarget:self
                            action:@selector(cancelButtonAction:)
                  forControlEvents:UIControlEventTouchUpInside];
    [self.cancelButton setTitle:@"Cancel" forState:UIControlStateNormal];
    self.cancelButton.frame = CGRectMake(200.0, 0.0, 100.0, 100.0);
    [self.scrollView addSubview:self.cancelButton];
}

and the EXC_BREAKPOINT happens on the self.cancelButton. I have ZombiesEnabled, but apart from the button I cannot see anything else - where should I look at?

0

There are 0 answers