Post

Replies

Boosts

Views

Activity

LiveActivity not starting - error: target does not include NSSupportsLiveActivities plist key
I'm trying to start a live activity that allows a user to see and control a recording from their lock screen. I have an AppIntent that uses a class to start recording the user. The intent is used in a home screen widget. Upon pressing the button in the widget, the intent is called, which then calls the startRecording function within its perform. This function then tries to start the live activity, but it is currently failing with a "Failed to start live activity: The operation couldn’t be completed. Target does not include NSSupportsLiveActivities plist key" error. The relevant code block is this: func startRecording() { print("[RecordingManager] start recording called") isRecording = true let activityAttributes = RecordingControlWidgetAttributes(name: "RecordingManagerActivity") let initialContentState = RecordingControlWidgetAttributes.ContentState(isRecording: true, startTime: Date()) let initialContent = ActivityContent(state: initialContentState, staleDate: nil) if ActivityAuthorizationInfo().areActivitiesEnabled { do { liveActivity = try Activity<RecordingControlWidgetAttributes>.request( attributes: activityAttributes, content: initialContent, pushType: nil ) } catch { print("Failed to start live activity: \(error.localizedDescription)") } } else { print("Live activities are not available") } // TODO: actually start the recording } When this function is run/the button is pressed, the following messages are printed: "[RecordingManager] start recording called Failed to start live activity: The operation couldn’t be completed. Target does not include NSSupportsLiveActivities plist key" However, I have included the NSSupportsLiveActivities key, with value YES, in the target Info in XCode for both the main app target and the WidgetExtension. The following line exists in both the Release and Debug parts of the project.pbxproj file: INFOPLIST_KEY_NSSupportsLiveActivities = YES; I also tried including this key and value directly in the Info.plist file of both targets, but that also didn't work. This issue is occurring both on device and in simulator. I also checked that both my device and the simulator has LiveActivities turned on in Settings for the app. What could be going wrong? Are there any other situations where this error may print?
0
1
482
Jul ’24