What communication to use, updateApplicationContext or sendMessage for constant data sync

951 views Asked by At

I have an iOS shopping list app, where items are added and displayed in a tableView. I want to create a Watch App Extension but I’m thinking of what is the best function call to use in this case, the updateApplicationContext(:) method or the sendMessage(:replyHandler:errorHandler:) method I was reading the documentation but I’m a little confused since both seem to work.

Here is the functionality I’m expecting to have…

What I want is to be able to add items in the iOS app even if the Watch app is Off, which is normal behavior, BUT I want the Watch app to update with whatever is in the tableView (in iOS) as soon as it is turned on and even if the iPhone is not On at the time the Watch is turned on.

In other words, I want the data in the iOS app to always be in sync with the Watch app.

Which is the best function call to use in this case, the updateApplicationContext(_:) method or the sendMessage(_:replyHandler:errorHandler:) method?

Thanks

1

There are 1 answers

2
eNeF On BEST ANSWER

As for me, I would use updateApplicationContext(_:) since you would want to update it in real time or in the background as it gets connected.

as for this sendMessage(_:replyHandler:errorHandler:) The cons is The isReachable property must currently be true for these methods to succeed. so you might get a slight delay to update your UI until it is reachable and ask for updates.