After upgrading to Xcode 7.0 I get a warning in the UIViewControllerRotation method: - (NSUInteger)supportedInterfaceOrientations
:
Conflicting return type in implementation of 'supportedInterfaceOrientations': 'UIInterfaceOrientationMask' (aka 'enum UIInterfaceOrientationMask') vs 'NSUInteger' (aka 'unsigned int')
Why is that, and how do I fix it?
EDIT:
If you go to the definition you'll see that the return type acctually has changed:
- (UIInterfaceOrientationMask)supportedInterfaceOrientations NS_AVAILABLE_IOS(6_0);
but changing the return type in the code doesn't silence the warning.
Try this tweak:
#if __IPHONE_OS_VERSION_MAX_ALLOWED < 90000
- (NSUInteger)supportedInterfaceOrientations
#else
- (UIInterfaceOrientationMask)supportedInterfaceOrientations
#endif
{
return UIInterfaceOrientationMaskPortrait;
}
I am using this one:
#if __IPHONE_OS_VERSION_MAX_ALLOWED < __IPHONE_9_0
#define supportedInterfaceOrientationsReturnType NSUInteger
#else
#define supportedInterfaceOrientationsReturnType UIInterfaceOrientationMask
#endif
- (supportedInterfaceOrientationsReturnType)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskPortrait;
}
... a little bit longer than Nishant's fix but a little bit clearer, I think.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With