WatchOS 3 Water Lock Programatically

Hi,

We're working on an application for water sports, and are running into a few interesting issues. The first (and most important issue) is that there doesn't seem to be any way of initiating the device's Water Lock programatically? I'm really hoping that I'm missing something obvious because this would essentially kill all water-based apps before they even get off the ground. Does anyone know if it's possible to initiate Water Lock Programatically?


Thanks!

BUMP... same here. I would really like to know if this is possible.

The best thing that you can do would be to submit a bug report. Apple tracks these to indicate priority of features.


http://bugreporter.apple.com

Agreed - is this possible ?

What do you mean by "Water Lock"? If you mean the feature that the app reverts to the clock when you stick it in water then check out:


        HKWorkoutConfiguration *configuration = [[HKWorkoutConfiguration alloc] init];
        configuration.activityType = HKWorkoutActivityTypeSwimming;
        configuration.locationType = HKWorkoutSessionLocationTypeIndoor;
     
        NSError *error = nil;
        hKSession = [[HKWorkoutSession alloc] initWithConfiguration:configuration error:&error];
     
        if (hKSession == nil) {
            /
            NSLog(@"*** Unable to create the workout session: %@ ***", error.localizedDescription);
            return;  /
        }
     
        hKSession.delegate = self;
        [healthStore startWorkoutSession:hKSession];


But be sure to turn it off after you are done with:


    if(hKSession!=nil)
            [healthStore endWorkoutSession:hKSession];

-(void)workoutSession:(HKWorkoutSession *)workoutSession didChangeToState:(HKWorkoutSessionState)toState fromState:(HKWorkoutSessionState)fromState date:(NSDate *)date{
    NSLog(@"workoutsession state changed to state %ld",(long)toState);
    if(toState==3){
        workoutSession=nil;
        hKSession=nil;
    }
}
WatchOS 3 Water Lock Programatically
 
 
Q