0

I have a swift music app that plays content from streaming providers on speakers.

The main app makes all the network calls and takes advantage of background audio to enable lock screen control.

I now have a Today Extension, I have setup app groups and use userdefaults to share metadata. I currently run urlsessions within the extension code to activate play/pause/skip/volume,etc... but this will not update the background audio or lock screen controls. It also seems inefficient.

Is there a way to run a function in my main app by pressing a button on the widget?

Thanks, Paul

Paul Boyce
  • 23
  • 5
  • You have to open the host app using openURL Method on your button click , then run the function – Help Jan 09 '20 at 08:40

1 Answers1

1

Please checkout this link it will help you

Perform action in host app from Today extension(Widget) Without opening app ios

Jawad Ali
  • 13,556
  • 3
  • 32
  • 49
  • Thanks jawadAli, setting up Notification Center in my AppDelegate worked. I might try the Wormhole solution too and see what works better. – Paul Boyce Jan 09 '20 at 21:02