Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Working Sample iOS project #40

Open
redmacdev1988 opened this issue Dec 17, 2015 · 5 comments
Open

Working Sample iOS project #40

redmacdev1988 opened this issue Dec 17, 2015 · 5 comments

Comments

@redmacdev1988
Copy link

Hi Lee,

thank you for this plugin. However, I'm running into numerous problems trying to make it work.

For examle, I'm having trouble getting the device and watch to communicate. I'm using UserDefault and its simply not getting the values.

On the app side, the messages are being sent successfully, but I get little issues such as applewatch.init's success function not getting run.

On the Watch Ext side, its not receiving the messages. I'm simply checking the NSUserDefaults with the group name but to no avail.

- (void)willActivate {
//InterfaceController.m
 NSUserDefaults * userDefaults = [[NSUserDefaults alloc] initWithSuiteName:@"group.com.yoyo"];
    [userDefaults synchronize];
    
    NSString * myValue = [userDefaults stringForKey:@"myKey"];
        
    if(myValue) {
        NSLog(@"InterfaceController.m - myValue %@", myValue);
        [self.displayLabel setText:myValue];
    }
    else {
        NSLog(@"myValue is null :(");
        [self.displayLabel setText:@"NULL"];
    }
}

In Staging folder, Staging/www/js/index.js

I have a button where I run:

function sendMessageButtonClicked() {
    
    applewatch.sendUserDefaults(function(){
     console.log('index.js - sendUserDefaults sent to watch');
     },
     function(){
     console.log('index.js - sendUserDefaults failed...');
     },
     { "myKey": "EVIAN" },
     "group.com.yoyo");
}

Anyways, can you offer a sample project on how to get everything to work? It may be a great way to resolve all of my issues and be a help to others.

thank you for your time!

@patronovski2
Copy link

I need also a sample project. I also cant get it working, there is no communication between the watch (watchos 2) and app.

@mouryaamit
Copy link

+1
Anybody got any solution

@patronovski2
Copy link

Nobody?

@jingkecn
Copy link
Contributor

For listening messages from iPhone, it works for me to use watchConnectivityListeningWormhole. listenForMessageWithIdentifier instead of wormhole.listenForMessageWithIdentifier.
It's quite strange that wormhole.listenForMessageWithIdentifier only works for initializing the first message, maybe the sample marked in README doesn't conform the Delegate Pattern

@JasonTolliver
Copy link

as a note to anybody reading this, watchOS2 and on removed the ability to share user defaults across your apps. Essentially, each app owns its own defaults, so if you expect to sendUserDefaults from the iOS app and have them available from the watch, it simply won't work anymore...

http://stackoverflow.com/questions/36050090/reading-nsuserdefaults-in-watchos-2-i-know-app-groups-doesnt-work#answer-36238647

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants