Post

Replies

Boosts

Views

Activity

Manually call App Intent from main app target
I would like to call my App Intent directly from my main app target, in an effort to start a live activity in the background when I receive a silent push notification from the server. I have seen in one of the WWDC developer lounges on Slack that this should be possible. Here is how I tried doing it: (it was recommended like that in the lounge) let appIntent = LiveActivityRefreshIntent() Task { try await appIntent() } But I get a compiler error: Instance method 'callAsFunction(donate:)' requires the types '(some IntentResult).Value' and 'Never' be equivalent It's strange because as far as I can tell, I cannot declare my perform method as returning Never. Here is the signature and return value of my App Intent's perform method: func perform() async throws -> some IntentResult { LiveActivityController.shared.updateLiveActivities() return .result() } Is there still a way to call the app intent from my code? If so, how?
0
1
393
Aug ’24