Post

Replies

Boosts

Views

Activity

Reply to Syncing changes between main app and extension
@DTS Engineer Update: This does work in iOS 18, but not quite in iOS 17. The steps I'm doing are pretty straightforward, and very similar to the sample app. Start Live Activity on some user action in the app Background the app, and expand Live Activity to show button Tap button, activating an AppIntent, which updates a SwiftData model and writes its persistent ID to shared UserDefaults Bring app back to foreground, which observes changes to scenePhase, and when .active, sync changes by calling ModelContext.fetch. On iOS 18, this works, and the model returned from the fetch call has the latest change written by the AppIntent executed by the Live Activity. On iOS 17 however, the fetched model still contains old data. If I relaunch the app, then I get the updated data in the model, so the change is written, but is not seen when first calling fetch on it. This seems like a bug, and something that was fixed in iOS 18. Is that a correct assumption?
Sep ’24