ios - iPhone to WatchKit Communication -


i able send data watch parent app

[wkinterfacecontroller openparentapplication:applicationdata reply:^(nsdictionary *replyinfo, nserror *error) {}]  

api how send data iphone watch in objective c.

you have ways achieve that. easiest 1 using mmwormhole.

you send data using:

[self.wormhole passmessageobject:@{@"titlestring" : title}                        identifier:@"messageidentifier"]; 

and receive using:

[self.wormhole listenformessagewithidentifier:@"messageidentifier"   listener:^(id messageobject) {     // }]; 

note wormhole uses app groups communicate, need enable it.

what mmwormhole uses, under hood, cfnotificationcentergetdarwinnotifycenter. implementation simple , if want own implementation have more info cfnotificationcentergetdarwinnotifycenter in medium post.


Comments