Skip to content

allow compiling with xcode 10 #186

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 10, 2020
Merged

allow compiling with xcode 10 #186

merged 2 commits into from
Jun 10, 2020

Conversation

Preeternal
Copy link
Contributor

@Preeternal Preeternal commented May 29, 2020

Fix for the issue

изображение

@luancurti luancurti requested a review from vonovak June 9, 2020 15:31
@vonovak
Copy link
Member

vonovak commented Jun 10, 2020

hello @Preeternal and thank you for your PR. Forgive me, I'm not super familiar with these kind of issues. Why did you pick this solution:

#if __IPHONE_OS_VERSION_MAX_ALLOWED < 130000
@interface UIColor (Xcode10)
+ (instancetype) labelColor;
@end
#endif

as opposed to using

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
    if (@available(iOS 13, *)) {
        defaultColor = [UIColor labelColor];
    }
#endif

What does the proposed solution do? Is it just telling xcode 10 to "trust the developer" that there is a labelColor on UIColor? thank you!

@Preeternal
Copy link
Contributor Author

Hello @vonovak As you know we got the error no known class method for selector 'labelColor' in xCode 10. In xcode 10 we have iOS SDK 12.5.
Because the method was introduced in iOS 13.0 SDK, we have to declare this method for SDK < 13 in some way.
About your question, why if statement with @available SDK check doesn't working, for me it also doesn't clear. Probably it happened after code obfuscation. I don't know.
But in this library you can find the similar issue and similar solution

@vonovak
Copy link
Member

vonovak commented Jun 10, 2020

the available check is a runtime check, #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 is a compile-time check which is why there is no known class method for selector 'labelColor' in xCode 10 when the check is not there

@vonovak vonovak merged commit 42f7118 into react-native-datetimepicker:master Jun 10, 2020
@vonovak
Copy link
Member

vonovak commented Jun 10, 2020

Thank you!

@Preeternal Preeternal deleted the UIColor-labelColor-fix-for-Xcode-10 branch June 12, 2020 18:59
@vonovak vonovak changed the title UIColor labelColor allow compiling with xcode 10 Jun 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants