ios - "Convenience initializer missing a 'self' call to another initializer" -


i'm trying convert code ios 8 project, , need explanation on how fix warning: "convenience initializer missing 'self' call initializer"

on code:

-(instancetype) initwithcoder:(nscoder *)adecoder // warning: convenience initializer missing 'self ' call initializer {     if (self = [super initwithcoder:adecoder]) // warning: convenience initializer should not invoke initializer on 'super'     {     // init stuff here     }     return self; } 

the new clang shipping xcode 6 enables compiler-enforced designated initializers through ns_designated_initializer macro. when marks 1 of init-family methods in class's declaration, other initializers considered "secondary" (to use apple's terminology) initializers. is, should call through 1 designated or secondary initializer until reach designated initializer.

uiview marks nothing designated initializer, somewhere you've declared init method of class designated initializer. because of that, nscoder's initializer becomes marked secondary , generates warning. i've filed radar (rdar://17559176) it, until can turned off on per-file basis specifying -wno-objc-designated-initializers, or providing appropriate diagnostic push-pop -wobjc-designated-initializers.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -