ActivityKit request with pushType = .token results in undocumented PermissionError

I just upgraded to Ventura beta 5 in the hopes of testing the push path for Live Activities in ActivityKit.

I am getting an undocumented error that I can't figure out when I request an activity. I created FB11226441 for this observed defect against beta 5.

Error: Error Domain=com.apple.ActivityKit.ActivityInput Code=0 "(null)" UserInfo={NSUnderlyingError=0x600003b14db0 {Error Domain=SessionCore.PermissionsError Code=4 "(null)"}}

        do {
            let activity = try Activity<PizzaDeliveryAttributes>.request(
                attributes: pizzaDeliveryAttributes,
                contentState: initialContentState,
                pushType: .token
            )

            print("Requested a pizza activity with id: \(activity.id)")
        } catch {
            print("Error: \(error)")
        }

Has anyone overcome this error?

I triple read the guide but haven't found anything I missed in my setup.

  • Ensured remote notifications capability is checked
  • Ensured running macOS Ventura beta w/ M1 Mac
  • Ensured Live Activities permission is granted for the app
  • Ensured requested user notification permission
  • Reset the simulator a few times to start fresh against beta 5

I tried this against Xcode 14 beta 5, Ventura beta 5.

Accepted Reply

I resolved this by ensuring the application target had the push capability added. After adding, the error went away.

I updated my feedback to Apple with sample project and a request for a named swift error type for this error condition. FB11226441

Replies

I am seeing the same thing. Works fine without using a token, gives an error when the token is included.

  • @developer555, make sure that you add the push notification capability to your application target. I marked this as the solution below as it resolved the issue in my demo app.

Add a Comment

I resolved this by ensuring the application target had the push capability added. After adding, the error went away.

I updated my feedback to Apple with sample project and a request for a named swift error type for this error condition. FB11226441