IOS Swift: не удалось найти назначение кнопки LiveActivityIOS

Программируем под IOS
Anonymous
IOS Swift: не удалось найти назначение кнопки LiveActivity

Сообщение Anonymous »


I show some content in LiveActivity Dynamic Island and added a button. As buttons work with App Intent I created an Intent. When the button is clicked I get the following error

Could not find an intent with identifier MyIntent, mangledTypeName: Optional("19LiveWidgetExtension10MyIntentV")

MyIntent.swift

import Foundation import AppIntents struct MyIntent: LiveActivityIntent { public init() { } func perform() async throws -> some IntentResult { print("click") return .result() } } MyLiveActivity.swift

... DynamicIslandExpandedRegion(.bottom) { HStack(alignment: .top) { Button(intent: MyIntent()) { Image(systemName: "bolt.fill") } } .tint(.white) .padding() } .... How can I register the Intent? Do I have to put something in the plist file? Any ideas?


Источник: https://stackoverflow.com/questions/780 ... ity-button

Вернуться в «IOS»