Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#import "InterfaceController.h"
#import <WatchConnectivity/WatchConnectivity.h> //Don't forget to import
@interface InterfaceController()<WCSessionDelegate>
@property (strong, nonatomic) NSDictionary *applicationDict;
@end
@implementation InterfaceController{
}
- (void)awakeWithContext:(id)context {
//Activate Session
if ([WCSession isSupported]) {
WCSession *session = [WCSession defaultSession];
session.delegate = self;
[session activateSession];
}
//Activate Session
//Send Application Context
NSDictionary *applicationDict = @{@"key" : @"value"};
[[WCSession defaultSession] updateApplicationContext:applicationDict error:nil];
//Send Application Context
}
#pragma mark - WCSessionDelegate
- (void)sessionWatchStateDidChange:(WCSession *)session
{
NSLog(@"%s: session = %@", __func__, session);
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.