Reputation: 215
I have added some watchOS 3 features to an existing watchOS 2 as I have to support both WatchOS 2 and WatchOS 3 devices so I need to check the function availability before it gets called. for example in ExtensionDelegate I have this function which only WatchOS 3 devices should call it, how can I check the WatchOS version in objective c.
-(void)applicationDidEnterBackground {
[self scheduleRefreshBackgroundTask];
}
I have read How to check iOS version? but I'm still confused how to check it in objective c.
Upvotes: 1
Views: 431
Reputation: 215
I finally found out that by adding WK_AVAILABLE_WATCHOS_ONLY(3.0)
I can control the watchOS versions when I need to add the watchOS 3 features to an existing watchOS 2 project and make them compatible:
- (void)applicationDidEnterBackground
{
[self scheduleRefreshBackgroundTask];
}
- (void)scheduleRefreshBackgroundTask WK_AVAILABLE_WATCHOS_ONLY(3.0)
{
// do something
}
Upvotes: 1