Uses modern version detection API instead of floating point comparison. #13

Merged
merged 3 commits into from Apr 16, 2015

Projects

None yet

5 participants

@steipete
Member

While the current way of checking for the version is not deprecated,
converting the system version string to float isn’t a good idea either.

The framework is for iOS 8 and above, so we can use the new Foundation API.

@steipete steipete Uses modern version detection API instead of floating point comparison.
While the current way of checking for the version is not deprecated,
converting the string to float isn’t a good idea either.

The framework is for iOS 8 and above, so we can use the new Foundation API.
e4f8af5
@Tricertops

I would make a function.

@steipete
Member

I was debating extracting this into a macro or function, but wanted to keep it close to the original.

@jwe-apple
Member

Yep, looks good to me, but we should also remove the #if's while we're here. The project has nullability in the headers so pre-8.3 tools cannot be used anymore.

@Tricertops

What about using +instancesRespondToSelector: check? Or that UIFont method was present (and private) before iOS 8.2?

[UIFont instancesRespondToSelector:@selector(systemFontOfSize:weight:)];

Edit: Not sure what about the other cases.

@steipete
Member

@jwe-apple: re __IPHONE_8_2: Good point, overlooked that. I've updated my PR.

@jwe-apple
Member

@iMartinKiss Just responding to the selector is not indicative whether the API was public in this case.

@jwe-apple jwe-apple commented on an outdated diff Apr 15, 2015
ResearchKit/Common/ORKHealthAnswerFormat.m
@@ -35,9 +35,7 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
#import "ORKDefines_Private.h"
-#if !defined(__IPHONE_8_2)
#define HKBiologicalSexOther 3
@jwe-apple
jwe-apple Apr 15, 2015 Member

Almost! Remove the HKBiologicalSexOther redefinition too, that was only for pre-8.2 tools.

@steipete
Member

Great. Deleting code is always fun :)

@JGiola
JGiola commented Apr 15, 2015

I back @iMartinKiss and even for the check if the class can register to the HKUserPreferencesDidChangeNotification notification, as for the Apple documentation https://developer.apple.com/library/ios/documentation/DeveloperTools/Conceptual/cross_development/Using/using.html is better use a control in the like of
if (&HKUserPreferencesDidChangeNotification != NULL)

@YuanZhu-apple YuanZhu-apple added the ready label Apr 16, 2015
@YuanZhu-apple YuanZhu-apple merged commit d56fc3e into ResearchKit:master Apr 16, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment