标签: watchos-9

从 WidgetKit Complication 访问 iOS 应用程序/WatchOS 应用程序数据 (WatchOS 9)

我有一个应用程序,包括 Apple Watch 应用程序和 WidgetKit (iOS 16) 扩展。

\n

iOS 应用程序将数据发送WatchConnectivity到 Apple Watch 应用程序并在那里显示。它还使用 向 WidgetKit ( iOS 16-Lockscreen ) 扩展提供数据GroupUserDefaults。所有这些都可以正常工作\xe2\x9c\x85。

\n

我的问题:

\n

我现在正在尝试向WidgetKit complication extensionWatchOS 9)提供数据。我希望能够访问以前编写的UserDefaultsApple Watch 应用程序或共享的GroupUserDefaults. 但我无法访问其中的任何数据。我还检查了文档,但我找不到任何明确设计用于向并发症共享数据的方法。\nClockKit方法将不适用于WidgetKit并发症(https://developer.apple.com/documentation/widgetkit/converting- a-clockkit-应用程序)。

\n

是否有人设法将数据共享到 WidgetKit 复杂功能,而无需像 Apple 示例那样请求服务器 API?(https://developer.apple.com/documentation/widgetkit/adding_widgets_to_the_lock_screen_and_watch_faces

\n

widgetkit apple-watch-complication swiftui watchos-9

6
推荐指数
1
解决办法
993
查看次数