pebble sdk - pebbleCentral:watchDidConnect never gets called on iOS -
i have old pebble classic watch, upgraded latest firmware (3.8.2) , using latest pebble-sdk.
i have followed few simple steps install sdk, setup xcode project , adding code initialise , connect: https://developer.getpebble.com/guides/mobile-apps/ios/
my problem is, delegate method pebblecentral:watchdidconnect never gets called!
i using pebble time app on ipad install watchapp in watch, know ipad connected watch. same ipad runs ios app, apparently not discover watch.
i have tried import old test project colleague, had running year or 2 ago. same watch, same watchapp, of course older firmware , sdk versions. same result...
i think documentation on pebble site quite simple , easy follow. however, feel missing explanations of how , when watchdidconnect supposed triggered.
i missing simple step somewhere, quite lost in look!
any ideas welcome!
edit: code looks this:
viewcontroller.h:
#import <uikit/uikit.h> @import pebblekit; @interface viewcontroller : uiviewcontroller<pbpebblecentraldelegate> @end
viewcontroller.m:
#import "viewcontroller.h" @interface viewcontroller () @property (weak, nonatomic) pbwatch* connectedwatch; @end @implementation viewcontroller - (void)viewdidload { [super viewdidload]; [pbpebblecentral defaultcentral].delegate = self; [[pbpebblecentral defaultcentral] run]; nslog(@"pebble initialised"); } - (void)didreceivememorywarning { [super didreceivememorywarning]; // dispose of resources can recreated. } - (void)pebblecentral:(pbpebblecentral*)central watchdidconnect (pbwatch*)watch isnew:(bool)isnew { nslog(@"pebble connected: %@", [watch name]); self.connectedwatch = watch; } - (void)pebblecentral:(pbpebblecentral*)central watchdiddisconnect:(pbwatch*)watch { nslog(@"pebble disconnected: %@", [watch name]); if ([watch isequal:self.connectedwatch]) { self.connectedwatch = nil; } } @end
are calling -run
method, after setting pebble central? noticed code snippet in link posted not show central's delegate
being set.
[pbpebblecentral defaultcentral].delegate = self; // set delegate
[pbpebblecentral defaultcentral].appuuid = [[nsuuid alloc] initwithuuidstring:@"your pebble app uuid"]; // set app uuid
[[pbpebblecentral defaultcentral] run]; // call -run on central
Comments
Post a Comment