Hey guys,
I’ve just received my nearables and now I’m trying to start learning the framework. Naturally, I went with the first “hello world” type of app that I’ve found here but unfortunately it doesn’t work.
Here are the details:
Platform: iOS 9.3
Device: iPhone 6s
SDK: XCode 7.3
Language: Swift 2.0
Estimote framework integration: using Cocoapods
Here is the code:
-
in AppDelegate (changed the values with XXX):
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { // Override point for customization after application launch. ESTConfig.setupAppID("xxx", andAppToken: "XXX*") return true }
-
in ViewController (changed the values with XXX)
import UIKit class ViewController: UIViewController, ESTTriggerManagerDelegate { let triggerManager = ESTTriggerManager() override func viewDidLoad() { super.viewDidLoad() self.triggerManager.delegate = self // add this below: let rule1 = ESTOrientationRule.orientationEquals( .HorizontalUpsideDown, forNearableType: .Car) let rule2 = ESTMotionRule.motionStateEquals( true, forNearableIdentifier: "14d70de02e2fc220") let trigger = ESTTrigger(rules: [rule1, rule2], identifier: "tom the trigger") self.triggerManager.startMonitoringForTrigger(trigger) } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } func triggerManager(manager: ESTTriggerManager, triggerChangedState trigger: ESTTrigger) { if (trigger.identifier == "tom the trigger" && trigger.state == true) { print("Hello, digital world! The physical world has spoken.") } else { print("Goodnight. <spoken in the voice of a turret from Portal>") } } }
What I have noticed:
1.I first tried with another sticker (the dog) and:
- first time it didn’t worked
- tried again (building again the solution) and it worked
- closed and reopened the app -> it stopped working (aka the messages stopped appearing)
2.Tried with another sticker (the car) and:
-it does not work at all
3.Tried with the Estimote iOS app and:
-the dog sticker stopped appearing on the scanner
-the car sticker appears without a problem
I don’t know how to tackle this situation so any help will be appreciated.
Later edit: now it seems that also the car sticker stopped being detected both by my app and the Estimote app. Further more, the app cannot detect another one (the bike). I have tested on iOS and Android and I get the same outcome. Maybe there’s a hardware issue?