I want to create one button in watch and while tapping on watch start one process to my ios app. How can I send the data between 2 devices
-(void)viewWillAppear:(BOOL)animated
{
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(sayHello:) name: @"sayHelloNotification" object: nil];
}
plus
[[NSNotificationCenter defaultCenter] postNotificationName: @"sayHelloNotification" object: nil];
in my button watch but it doesn't work
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:
To react on this message you should implement in counterpart
WCSessionDelegate
:or