"Missing warning [super dealloc]" in the ARC project

I reorganized the project into ARC. It looks great, but there is an object that uses the notification center. I removed the observer in the user dealloc method. This worked fine in a project without ARC. It also works in ARC, but I get a crazy warning: "The method may be missing a call [super dealloc]." In an ARC project, this is automatically done for me when the method ends. Even better: I should not call it in ARC projects! It must be an Xcode error, right? Here is my code:

- (void)dealloc {
    [[NSNotificationCenter defaultCenter] removeObserver:self];
    // [super dealloc]; will be called automatically
}

I always want to write code that does not throw a warning. Is there a way around this yellow exclamation mark?

+5
source share
3

dealloc, , ARC:

#if ! __has_feature(objc_arc)
#error "ARC is off"
#endif

, , ARC . , .

+10

, :

  • target (<yourapp>.xcodeproj), (<classname>.m)
  • TARGET
  • -fobjc-arc

enter image description here

+1

" ?"

, Xcode

  • > >
  • Menu> Product> (press alt) Clear project folder
  • restart xcode

After that, I got more warnings related to ARC, so it is clear that Xcode has not been converted to ARC. Now the warning has disappeared and everything is working fine.

0
source

All Articles