Designated initializer missing a 'super' call

#1

I’m getting a couple warnings when I change the designated initializer for UITableViewController to init.

  1. Designated initializer missing a ‘super’ call to a designated initializer of the super class.
  2. Designated initializer should only invoke a designated initializer on ‘super’

Anyone else getting these warnings? Here’s my code:

  • (instancetype)init
    {
    // Call the superclass’s designated initializer
    self = [super initWithStyle:UITableViewStylePlain];
    if (self) {
    for (int i = 0; i < 5; i++) {
    [[ItemStore sharedStore] createItem];
    }
    }
    return self;
    }

  • (instancetype)initWithStyle:(UITableViewStyle)style[/color]
    {
    return [self init];
    }

#2

Yes, I am getting the same warnings.
With the changing of the designated initializer. I think xcode6 is just trying to make sure you are aware you’re modifying the default.

//Designated Initializer is initWithStyle Changing to init -(instancetype)init { //Call the SuperClass's designated initializer self = [super initWithStyle:UITableViewStylePlain]; return self; } -(instancetype) initWithStyle:(UITableViewStyle)style // Warning here { return [self init]; // and here }

#3

I have the same too, I guess you’re right Synapse001.

But if there is a warning, it means that we should do differently, shouldn’t we ? What would be the correct way to do then ?