Annoying warning: Integer constant not in the range of enumerated type 'UIViewAnimationOptions' Annoying warning: Integer constant not in the range of enumerated type 'UIViewAnimationOptions' ios ios

Annoying warning: Integer constant not in the range of enumerated type 'UIViewAnimationOptions'


You are doing nothing wrong. As you already noticed, the compiler complains because thevalue is none of the values defined in the enumeration. (The compiler flag -Weverything implies this check.)

You can suppress the warning either by an explicit cast:

options:(UIViewAnimationOptions)(UIViewAnimationOptionAutoreverse | UIViewAnimationOptionRepeat) 

or with a #pragma:

#pragma clang diagnostic push#pragma clang diagnostic ignored "-Wassign-enum"[UIView animateWithDuration:0.5                      delay:0                    options:UIViewAnimationOptionAutoreverse | UIViewAnimationOptionRepeat                 animations:^{                     self.imgCheckIn.backgroundColor = [UIColor redColor];                 }                 completion:nil];#pragma clang diagnostic pop