swift - Communicate data between WatchOS & Today Extension widget -
standard set watch os > 2. wcsessiondelegate
used coordinte data between main application , watch.
an app group "group.***********.todayextensionwidget"
used coordinate data between main application , today extension widget via userdefaults(suitename: "group.***********.todayextensionwidget")
when make change watch communicates change main application. main application (once launched) communicates on today extension. communicate change in watch app today extension without needing launch main app first.
is there best practice communicate between watch app , today extension widget?
at moment there no way achieve using built-in frameworks. since introduction of watchos2
, watchkit
apps considered independent apps , not extension of ios
app, hence cannot use appgroups
share data between 2 , cannot use share data between watchkit
app , ios
extension.
as experienced, watchconnectivity
cannot used in today extension
, out of picture well.
your option suboptimal one, since need upload data server watchos
app , download in ios today extension
. of course generates unnecessary data usage, current frameworks provided apple cannot share data offline.
however, if wait until watchos4
released (or give beta version try), might able leverage corebluetooth
framework, becoming available watchkit
in watchos4
communicate between watchkit
app , ios
extension offline, using ble
. not 100% sure if corebluetooth
can used in ios extensions
, should give try if can use watchos4 beta
.
Comments
Post a Comment