4

I'm shifting between Xcode 6 and 7 quite frequently, and want a way to avoid build warnings like this one.

Conflicting return type in implementation of 'supportedInterfaceOrientations': 'UIInterfaceOrientationMask' (aka 'enum UIInterfaceOrientationMask') vs 'NSUInteger' (aka 'unsigned long')

I can't seem to use a type that will satisfy both versions of Xcode simultaneously. So I was going to implement a preprocessor macro which had different values depending on the value of __IPHONE_9_0.

#ifdef __IPHONE_9_0
#define CompatibilityUserInterfaceMask  UIInterfaceOrientationMask
#else
#define CompatibilityUserInterfaceMask  NSUInteger
#endif

When I try and implement this though I get a build error.

- (CompatibilityUserInterfaceMask)supportedInterfaceOrientations { ... }

Is this possible, or does anyone have other ideas to achieve the same outcome?

1 Answer 1

2

As far as I can tell your macro should just work, but if you want a slightly different approach (arguably uglier):

#if __IPHONE_OS_VERSION_MAX_ALLOWED < 90000  
- (NSUInteger)supportedInterfaceOrientations  
#else  
- (UIInterfaceOrientationMask)supportedInterfaceOrientations  
#endif  
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.