Software added app crash button

When I press my button, the application crashes. It happens even when I create a button programmatically or try to add one via XIB for a class where I need a button.

I turned on Zombies and the debugging mail I receive from the console:

2010-10-27 00: 47: 28.643 CarTrawler [1537: 207] * - [ReceiptView performSelector: withObject: withObject:]: the message was sent to the freed instance 0x76cb700

But the button is added to the view. So I don’t understand what the problem is. A class is a receipt, so it is called depending on how many receipts are in the application.

- (void)viewDidLoad {
[super viewDidLoad];
self.refLabel.text = theBooking.confID;
self.carTypeLabel.text = theBooking.vehMakeModelName;
//self.amountLabel.text = [NSString stringWithFormat:@"€22.00"];
self.locationLabel.text = [NSString stringWithFormat:@"%@, %@", 
    theBooking.locationName, theBooking.locationAddress];
self.numberLabel.text = theBooking.locationPhoneNumber;

self.dateTimeLabel.text = theBooking.puDateTime;
self.doDateTimeLabel.text = theBooking.doDateTime;
DLog(@"Dropoff date time label is %@", theBooking.doDateTime);

CTTableViewAsyncImageView *thisImage = [[[CTTableViewAsyncImageView alloc] 
initWithFrame:CGRectMake(0.0, 0.0, 64.0, 40.0)] autorelease];
[vendorImage addSubview:thisImage];
NSURL *url = [NSURL URLWithString:theBooking.vehPictureUrl];
[thisImage loadImageFromURL:url];

UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
button.frame = CGRectMake(220, 270, 60, 30);
[button setTitle:@"Email!" forState:UIControlStateNormal];
[button addTarget:self action:@selector(buttonPressed)   
forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:button];

}


-(void)buttonPressed {
NSLog(@"Button Pressed!");
}

Can someone explain to me what I forgot?

+3
source share
1

, .

, , ?

+1

Source: https://habr.com/ru/post/1771600/


All Articles