I am attempting to integrate iBeacons with a WatchKit app for a test application I'm developing. The beacons are basically being used to simulate geofencing. The app, from the user perspective, functions like this:
- User opens their WatchKit app.
- WatchKit app open parent application using the appropriate method.
- iOS app replies with a list of beacons that it is detecting
- WatchKit app checks each beacon.major versus a hardcoded jSON file, and displays a table of objects whose beacon value matches one of the detected beacons.
The iOS app is correctly displaying beacon notifications when in range. The WatchKit app can correctly exchange dummy data with the iOS app. Both of these happen even if the iOS app is initially closed. However, if the iOS app is closed or running in the background, the replyInfo object returned from the App Delegate becomes nil if I'm attempting to pass active beacon data. If I make the application ACTIVE and refresh the view, then the object returns a value (a list of beacons). I have the beacon initialization code in the App Delegate, using almost exactly the same code as here: http://ibeaconmodules.us/blogs/news/14702963-tutorial-swift-based-ibeacon-app-development-with-corelocation-on-apple-ios-7-8
Is there something that I need to be doing to allow my WatchKit app to obtain beacon data from the iOS app when they are running in Background mode? I have seen some information that indicates that a Background Task might be needed. Does this sound like the case?
My deployment target on the app and watchkit app are 8.3. I have not updated XCode for 8.4 yet.