leecrossley / cordova-plugin-apple-watch

Cordova / PhoneGap Apple Watch Plugin for Apache Cordova
http://ilee.co.uk
264 stars 43 forks source link

Communication between Iphone and Apple watch #14

Closed ghost closed 9 years ago

ghost commented 9 years ago

Hello, I don't understand because in this plugin you use MMwormhole and don't use "Sharing Data with Your Containing iOS App" or "Communicating Directly with Your Containing iOS App" (source: https://developer.apple.com/library/ios/documentation/General/Conceptual/WatchKitProgrammingGuide/DesigningaWatchKitApp.html#//apple_ref/doc/uid/TP40014969-CH3-SW1 ). Why can't you communicate without MMwormhole? Why don't you have create a plugin that communicate directly with the WatchKit Extension? Why should I use the MMwormhole?Is there an advantage? Thanks!

leecrossley commented 9 years ago

When using the "message passing" communication, as outlined in the readme, MMWormhole creates a bridge between an the native app code and the Watch Extension. This plugin provides a bridge from the WebView to MMWormhole and therefore the Watch Extension. MMWormhole is completely hidden to you in this process.

leecrossley commented 9 years ago

You can then reference and use MMWormhole in your WatchKit Extension to pass messages back to your WebView.

ghost commented 9 years ago

Ok but why do you use MMWormhole? Could you use the general method on the official doc namely "Sharing Data with Your Containing iOS App" or "Communicating Directly with Your Containing iOS App" ?

leecrossley commented 9 years ago

MMWormhole does use the "general method", I use MMWormhole so not to duplicate effort. Please read the docs and open a specific issue with the plugin if you have one - thanks.