0

I'm running one of my Objective-C project on XCode 12.0. I have UIControl subclass "SeatingPanelControl" from which another subclass is created named "IpadSeatingPlanControl", wherein I'm getting crash while executing the below code with exception as mentioned the title (also given in screenshot):

//IpadChamberViewController.m
self.seatingPlanControl = [[[IpadSeatingPlanControl alloc] initWithFrame:CGRectMake(0, self.view.bounds.size.height * 4/7,[self.view bounds].size.width,[self.view bounds].size.height * 3/7 + 20.0)] autorelease];

enter image description here

UPDATE (Solution):

I figured out the cause of the issue. I removed one line of code by mistake while fixing the issue with IMP for XCode 12. It was running okay for iPhone, but not for iPad as per current setup of the code. Restoring the line of code fixed the problem.

enter image description here

iAkshay
  • 1,143
  • 1
  • 13
  • 35

1 Answers1

1

Check out that your IpadChamberViewController calls [super init...] in his initializer

Phil Dukhov
  • 67,741
  • 15
  • 184
  • 220
  • Sorry I missed on complete details. Please check my edited question and updated screenshot. IpadSeatingPlanControl is subcass of SeatingPlanControl which is subclass of UIControl. – iAkshay Aug 10 '21 at 14:50
  • @iAkshay looks like the problem is in `IpadSeatingPlanControl` `initWithFrame`, show its code – Phil Dukhov Aug 10 '21 at 15:32
  • IpadSeatingPlanControl don't have initWithFrame method. Only 1 method is there: drawRect(). So when I call IpadSeatingPlanControl initWithFrame, the same method from SeatingPlanControl called. – iAkshay Aug 10 '21 at 15:46
  • @iAkshay ok can you show be `IpadChamberViewController` `init` method which was used to create it? according to crash log it has problem – Phil Dukhov Aug 10 '21 at 15:48
  • 1
    I figured it out, there is missing line of code, removed by mistake. Thank you so much for your time and kind help. – iAkshay Aug 10 '21 at 17:15
  • @iAkshay could you accept the answer if it helped you? – Phil Dukhov Aug 11 '21 at 04:27