I have an alarm app, recently powered it with a today widget extension.
I need to turn on and off alarm from today widget, but the code to "turn on" and "turn off" is within app, not widget.
How can I send a message
from today widget to main app?
You should write the setting to a shared group NSUserDefault value. See App Extension Programming Guide.
If you need to immediately notify the app from the extension or vice versa, you can also use Darwin notifications, but you can never be certain when either process will be active so you still have to persist the setting into NSUserDefaults. See CFNotificationCenter Reference.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With