Starting from watchOS 2.0 you could just send a message between two devices. You could send a message Watch->iPhone at any time (event if your iPhone counterpart isn't running) and iPhone->Watch if your watch counterpart is presenting. Just check [WCSession defaultSession].isReachable
to be sure you could send a message.
For both platform here's code example:
@import WatchConnectivity;
...
if ([WCSession defaultSession].isReachable) {
[[WCSession defaultSession] sendMessage:@{
@"Key" : @"Value"
} replyHandler:^(NSDictionary<NSString *,id> * _Nonnull replyMessage) {
NSLog(@"Sent update is OK");
} errorHandler:^(NSError * _Nonnull error) {
NSLog(@"Sent update with error %@", error);
}];
}
To react on this message you should implement in counterpart WCSessionDelegate
:
- (void)session:(WCSession *)session didReceiveMessage:(NSDictionary<NSString *, id> *)message;
or
- (void)session:(WCSession *)session didReceiveMessage:(NSDictionary<NSString *, id> *)message replyHandler:(void(^)(NSDictionary<NSString *, id> *replyMessage))replyHandler;