2

I have an app that can record durations which a user has spent on different projects.

The goal is that the user can start a stopwatch for a project from

  • The main iOS app running on the iPhone
  • The Today Widget
  • The Apple Watch

I have encountered a problem with synchronizing my stopwatch information across devices and I have spent already a lot of time on them without success:

Problem and Attempts:

When the user starts or stops a stopwatch in the Today Widget, I would like to wake up the iPhone app to update the badge on the iPhone app and to update the complication on the Apple Watch.

I've tried to add an observer to the NSNotificationCenter for changing NSUserDefaults. But the extension runs in a different process and NSNotificationCenter cannot handle this case.

I've also tried Darwin notifications (CFNotificationCenterAddObserver). They can deal with different processes but they work only if the iPhone app is active: They don't wake up my app.

Devices and OS

  • iPhone 6s with iOS 9.1
  • Apple Watch with watchOS 2.0.1
4

0 回答 0