Skip to content
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

Warning in XCode 7 #33

Closed
margusholland opened this issue Oct 13, 2015 · 3 comments
Closed

Warning in XCode 7 #33

margusholland opened this issue Oct 13, 2015 · 3 comments

Comments

@margusholland
Copy link

THLabel.m line 430:

CTTextAlignment alignment = NSTextAlignmentToCTTextAlignment ? NSTextAlignmentToCTTextAlignment(self.textAlignment) : [self CTTextAlignmentFromNSTextAlignment:self.textAlignment];

gives a warning "Code will never be executed".

Not really a problem, but I like to keep my code warning free, so might be worth fixing for people with similar needs.

@tobihagemann
Copy link
Owner

Not sure which warning flags you have set on your project, but that's absolutely right, if you target iOS 6.0 or higher. That code is just a workaround for iOS versions lower than 6.0. I guess it should be solvable with a __IPHONE_OS_VERSION_MIN_REQUIRED. Could you try this out, before I push an update?

#if defined(__IPHONE_6_0) && (__IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_6_0)
    CTTextAlignment alignment = NSTextAlignmentToCTTextAlignment(self.textAlignment);
#else
    CTTextAlignment alignment = NSTextAlignmentToCTTextAlignment ? NSTextAlignmentToCTTextAlignment(self.textAlignment) : [self CTTextAlignmentFromNSTextAlignment:self.textAlignment];
#endif

@margusholland
Copy link
Author

Yep, works fine with that new code snippet and the warning goes away. I’m not using any other warning flags that come with the default settings of XCode.

@tobihagemann
Copy link
Owner

Fixed in version 1.4.7

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

No branches or pull requests

2 participants