applewatch.init(function (appGroupId) { // success, messages may now be sent or listened for }, function (err) { // an error occurred }, "group.com.mycompany.watch");
I’ve the error message:
Can’t find variable: applewatch
I’ve check, my plugin is in my project.
I’ve removed and install the plugin but that change nothing…
I’ve had this problem when I didn’t call my plugin after $ionicPlatform.ready()
can you try to wrap your code into it ?
I have never used applewatch, but this could work.
I just tried to add the plugin to my App.
1- cordova plugin add cordova-plugin-apple-watch
2- the plugin is not present either in my package.json file
3- I put the init function in my app.js, in .run, in $ionicPlatform.ready()
4- The output is OK (no plugin undefined, just a bad config on apple-watch plugin)
I didn’t inject any particular dependency except $ionicPlatform.
I have the same info on my ionic, ecept npm 4.3.1.
.run(function($ionicPlatform, $rootScope) {
$ionicPlatform.ready(function() {
applewatch.init(function (appGroupId) {
// success, messages may now be sent or listened for
applewatch.sendMessage("Bonjour tout le monde", "myqueue");
}, function (err) {
// an error occurred
},
"group.com.mycomp");
});
})
@JC_cap Hi, sorry for the late answer I wasn’t in my office last week.
So, I’ve try with the simulator (iPhone et Apple Watch) and I didn’t have error message! Thank’s for your help.
Now I’ve to understand how that works. ^^
EDIT: @JC_cap Do you know how can I have the debug for the two application in XCode? I only have th debug for the watchkitExtension.