Communicator icon indicating copy to clipboard operation
Communicator copied to clipboard

observations not called

Open mathieutozer opened this issue 3 years ago • 2 comments

I have an issue where the phone is notified from the watch, but the following function fails on the phone but not the watch, even though the setup is identical on both

    static func notifyObservers(_ object: Self) {
        observations.store.forEach { observation in
            observation.key.queue.async {
                observation.value(object)
            }
        }
    }

The debugger isn't helpful when I hit a breakpoint either, so I have no idea what's going on. It's as though the observations is empty. I've tried holding onto the returned observation object when I call observe and also not doing that... any ideas?

mathieutozer avatar Jan 14 '21 00:01 mathieutozer

Experimenting further, if I remove my observation of Reachability, it works. Is the registration of Reachability conflicting / overwriting any other subscriptions?

ie commenting out this call restores the ImmedateMessages.

          Reachability.observe { reachability in
          }

mathieutozer avatar Jan 14 '21 00:01 mathieutozer

Hey!

That's interesting. I've got Reachability observations in the example app in the repo and that doesn't seem to be affected? Can you try giving that a try and see if you have the same issue?

Any specific version of iOS/watchOS or device?

Note that some background messaging doesn't work on the watchOS simulator (hasn't done since watchOS 6)

KaneCheshire avatar Jan 14 '21 17:01 KaneCheshire