ios - Warning: Method override for designated initializer -


i programmatically create several tables , code has worked fine years. did not generate warnings 2 weeks ago when last ran it. i’ve since updated ios 8.3 , 3 warnings each uitableviewcontroller.

method override designated initializer of superclass '-initwithstyle:' not found.

method override designated initializer of superclass '-initwithcoder:' not found.

method override designated initializer of superclass '-initwithnibname:bundle:' not found.

the code initialize table similar of tables:

- (instancetype)initinmanagedobjectcontext:(nsmanagedobjectcontext *)context                   withscorekeeper:(scorekeeper *)scorer                      withwordlist:(wordlist *)wordlist {      self = [super initwithstyle:uitableviewstylegrouped];      if (self) {         _mobjcontext = context;         _scorekeeper = scorer;         _wordlist = wordlist;     }     return self; } 

and .h looks this:

@interface settingstableviewcontroller : uitableviewcontroller {     uipopovercontroller *popover;  }     - (instancetype)initinmanagedobjectcontext:(nsmanagedobjectcontext *)context                       withscorekeeper:(scorekeeper *)scorer                          withwordlist:(wordlist *)wordlist ns_designated_initializer; 

i thought overriding designated initializer invoking self = [super initwithstyle:uitableviewstylegrouped];, guess compiler has other ideas.

so how override designated initializer?

calling [super initwithstyle:uitableviewstylegrouped] not overriding method in superclass; you're calling it.

i suspect ios 8.3 shows these warnings in objective-c (we have been getting these warnings while in swift).

i override methods rid of warnings:

- (instancetype)initwithstyle:(uitableviewstyle)style {     return [super initwithstyle:style]; } 

it doesn't need more in case.

update:

try changing convenience initializer this:

- (instancetype)initinmanagedobjectcontext:(nsmanagedobjectcontext *)context                   withscorekeeper:(scorekeeper *)scorer                      withwordlist:(wordlist *)wordlist {      self = [self initwithstyle:uitableviewstylegrouped]; // <-- self instead of super      if (self) {         _mobjcontext = context;         _scorekeeper = scorer;         _wordlist = wordlist;     }     return self; } 

that method convenience initializer , should call 1 of designated initializers in current class. 1 can call superview's designated initializer.


Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

order - Notification for user in user account opencart -