Код: Выделить всё
Failed to look up symbolic reference at 0x1006ac9bd - offset 162835 - symbol symbolic _____y_____GSg 11ActivityKit0A0C 19MyAppPlayerAttributesV in /private/var/folders/4d/wbdrh95d1pz_f5y659dt22gr0000gn/X/6723F443-F2B3-5BE2-99A0-82DA9EF5CB24/d/Wrapper/MyApp.app/MyApphere
Код: Выделить всё
//#if os(iOS) || os(watchOS)
#if canImport(ActivityKit)
import ActivityKit
#endif
Код: Выделить всё
#if canImport(ActivityKit)
func startLiveActivity() {
guard ActivityAuthorizationInfo().areActivitiesEnabled else { return }
let attributes = AudioPlayerAttributes(audioTitle: memoTitle, startDate: Date())
let initialContentState = AudioPlayerAttributes.ContentState(isPlaying: isPlaying, currentTime: currentTime, duration: duration)
let content = ActivityContent(state: initialContentState, staleDate: nil)
do {
activity = try Activity.request(attributes: attributes, content: content, pushType: nil)
print("*** audioPlayer Live Activity started")
} catch (let error) {
print("***🔥 Error starting Live Activity: \(error.localizedDescription)")
}
}
func updateLiveActivity() {
guard let activity = activity else { return }
let updatedContentState = AudioPlayerAttributes.ContentState(isPlaying: isPlaying, currentTime: currentTime, duration: duration)
let content = ActivityContent(state: updatedContentState, staleDate: nil)
Task.detached(priority: .background) {
await activity.update(content)
}
}
func endLiveActivity() {
guard let activity = activity else { return }
// Optionally provide final content
let finalContentState = AudioPlayerAttributes.ContentState(isPlaying: isPlaying, currentTime: currentTime, duration: duration)
let content = ActivityContent(state: finalContentState, staleDate: nil)
Task.detached(priority: .background) {
await activity.end(content, dismissalPolicy: .immediate)
print("*** audioPlayer Live Activity ended")
}
}
#else
func startLiveActivity() { }
func updateLiveActivity() { }
func endLiveActivity() { }
#endif
Должен быть обходной путь? В противном случае любое приложение с виджетом будет недоступно на Mac.
Будем благодарны за любую помощь!
Подробнее здесь: https://stackoverflow.com/questions/792 ... ctivitykit