user2296278 user2296278 - 11 days ago 5
iOS Question

watchkit , iOS sending data between watch and iphone

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

Answer

AFAIK, you can not share data directly, like send some datas between them.
What you can do is write data to same file.

See this blog post:
http://www.atomicbird.com/blog/sharing-with-app-extensions