I'm currently building a watchapp for Pebble which will have to communicate with one Swift app. I've implemented all the needed functions but every time I try to get the last connected Pebble from PBPebbleCentral I receive nil. This happens despite the fact that my Pebble is connected with the iPhone and I have PebbleKit and PebbleVendor correctly imported.
I'm using Pebble with firmware v2.7 and iPhone 5s running iOS 8.0.2. Further I have based my two apps on the weather-app example provided by Pebble.
defaultCentral.delegate = self
setTargetWatch(defaultCentral.lastConnectedWatch())
I found my mistake! I used to receive nil from lastConnectedWatch() because I'd initialized defaultCentral incorrectly.
My old code was:
And the correct code is: