• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: New error “Method override for the designated initializer of the superclass ‘-init’ not found”
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: New error “Method override for the designated initializer of the superclass ‘-init’ not found”


  • Subject: Re: New error “Method override for the designated initializer of the superclass ‘-init’ not found”
  • From: Quincey Morris <email@hidden>
  • Date: Tue, 09 Jun 2015 23:18:18 +0000

On Jun 9, 2015, at 15:23 , Sean McBride <email@hidden> wrote:

I also tried:

- (instancetype)init
{
assert(0);
}

Thinking maybe it would clue in on an old school assert, but no.

I was half-right before, in that using ’NS_DESIGNATED_INITIALIZER’ enables different rules for initializers in the compiler. Once you use that on an initializer that has parameters, you must override parameterless ‘init’ too, and the override has to be a designated initializer.

However, the syntax I suggested was wrong. You can only use ’NS_DESIGNATED_INITIALIZER’ in an @interface block, so you’d actually do it like this (in the .m file):

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

@implementation MyClass
- (instancetype) init {
assert (0);
}

Note that if you have other private initializer methods in the @implementation block only, you’ll have to pre-declare them in the class extensions so that you can mark the ’NS_DESIGNATED_INITIALIZER’ too.

I tried this in an actual source file, and the warnings did go away.

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: New error “Method override for the designated initializer of the superclass ‘-init’ not found”
      • From: Jens Alfke <email@hidden>
References: 
 >New error “Method override for the designated initializer of the superclass ‘-init’ not found” (From: Jens Alfke <email@hidden>)
 >Re: New error “Method override for the designated initializer of the superclass ‘-init’ not found” (From: Sean McBride <email@hidden>)

  • Prev by Date: Re: New error “Method override for the designated initializer of the superclass ‘-init’ not found”
  • Next by Date: Re: Is the f***ing NDA back, or why is no one talking about new stuff?
  • Previous by thread: Re: New error “Method override for the designated initializer of the superclass ‘-init’ not found”
  • Next by thread: Re: New error “Method override for the designated initializer of the superclass ‘-init’ not found”
  • Index(es):
    • Date
    • Thread