Objective-C warning Method override for the designated initializer of the superclass '-init' not found

In your .h files:

@interface MyClass : NSObject
- (instancetype)init NS_UNAVAILABLE;
@end
In .m files:

@interface MyClass ()
- (instancetype)init NS_DESIGNATED_INITIALIZER;
@end

@implementation MyClass
- (instancetype)init { @throw nil; }
@end

-(instancetype)init
{
    self = [super init];
    return self;
}

参考文章:

http://stackoverflow.com/questions/32741123/objective-c-warning-method-override-for-the-designated-initializer-of-the-superc

http://stackoverflow.com/questions/26185239/ios-designated-initializers-using-ns-designated-initializer

你可能感兴趣的:(Objective-C warning Method override for the designated initializer of the superclass '-init' not found)