OAuth2 icon indicating copy to clipboard operation
OAuth2 copied to clipboard

Base64 code uses Bad Macros

Open phoney opened this issue 8 years ago • 0 comments

I see warnings for use of deprecated methods in Base64.m when building for iOS using cocoapods. The problem is that the macros used to guard the code for iOS versions earlier than 7.0 are not correct.

This code doesn't work as intended on iOS.

#if __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_9 || __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_7_0

The problem is that on iOS __MAC_OS_X_VERSION_MIN_REQUIRED is undefined and thus has a value of zero so the comparison to __MAC_10_9 succeeds, when it shouldn't. The correct macro would be something like

#if (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_9) || (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) &&__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_7_0)

That should work on both OSes.

phoney avatar May 08 '17 23:05 phoney