Search code examples
iosobjective-cnsnotificationcenternsnotificationswatchkit

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


Solution

  • 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