Search code examples
iosiphonelatencyapple-watch

Strategy to Reduce Latency When Sending Data Between iPhone and Apple Watch?


Any strategies I can use to reduce the latency when sending data between iPhone and Apple Watch?

On the simulator sometimes the lag is often >0.1s meaning the counter (see code below) will often skip some numbers. After running the counter for a few seconds the lag increases to >1s and the counter skips 10+ numbers very frequently.

I'm trying to build a spritz-like app for Apple Watch which would require words to flash on screen at speeds of ~500 words per minute or 1 word every 0.12 seconds.

- (void)willActivate {
    // This method is called when watch view controller is about to be visible to user
    [super willActivate];
    self.number = 0;
    NSTimer *t = [NSTimer timerWithTimeInterval:0.1 target:self selector:@selector(updateLabelText) userInfo:nil repeats:YES];
    NSRunLoop *runner = [NSRunLoop currentRunLoop];
    [runner addTimer:t forMode: NSDefaultRunLoopMode];
}
- (void)updateLabelText {
    NSString *str = [NSString stringWithFormat:@"number %ld", self.number];
    [self.testLabel setText:str];
    self.number += 1;
}

Solution

  • You cannot guarantee update speeds on the Apple watch simply because of how the application communicates with the watch. UI updates are delivered usually after .1 seconds, making your sprintz like app impossible due to the current conditions.

    Maybe in a future framework will apple allow native watch apps, but right now, UI is sent to the phone which severely limits the dynamism of WatchKit apps.