【问题标题】:designated initializer missing a super call to a designated initializer of the super class指定的初始化程序缺少对超类的指定初始化程序的超级调用
【发布时间】:2017-09-01 06:50:48
【问题描述】:

我在 pod 中收到 2 个警告,例如 1. 指定初始化程序缺少对超类的指定初始化程序的超级调用。 2. 指定初始化器应该只在super上调用指定初始化器。

- (instancetype)initWithFrame:(CGRect)ignoredFrame { return [self init]; }

【问题讨论】:

    标签: ios objective-c xcode objective-c-2.0


    【解决方案1】:

    试试下面的代码,这将消除警告

    - (instancetype)initWithFrame:(CGRect)ignoreframe {
        self = [super initWithFrame:ignoreframe];
        if (self) {
            // load view frame XIB
        }
        return self;
    }
    

    想了解更多详情,请关注here

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-03-11
      • 2016-05-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-05-16
      相关资源
      最近更新 更多