Cannot get DeviceActivityReport to work

I am unable to make any progress regarding DeviceActivityReport. The session from WWDC 2022 covers it very briefly. What I (hopefully correctly) understood is that we need to create an extension of type Activity report and inside it implement the body which is DeviceActivityReportScene that will display the charts and what not. And then in the app, we need to use DeviceActivityReport with SwiftUI to show the report which will be run in sandbox from the extension. But I cannot get anything to show up on the screen. Even when my extension view is just a static text to verify something gets displayed. I am trying to create the device activity report without any filter which should give me all activity data per the docs.

This is shown in the Xcode console for the view that uses DeviceActivityReport.

2022-06-17 18:08:47.219785+0200 DeviceActivityTest[9613:954204] [default] LaunchServices: store (null) or url (null) was nil: Error Domain=NSOSStatusErrorDomain Code=-54 "process may not map database" UserInfo={NSDebugDescription=process may not map database, _LSLine=66, _LSFunction=_LSServer_GetServerStoreForConnectionWithCompletionHandler}
2022-06-17 18:08:47.219862+0200 DeviceActivityTest[9613:954204] [default] Attempt to map database failed: permission was denied. This attempt will not be retried.
2022-06-17 18:08:47.219911+0200 DeviceActivityTest[9613:954204] [db] Failed to initialize client context with error Error Domain=NSOSStatusErrorDomain Code=-54 "process may not map database" UserInfo={NSDebugDescription=process may not map database, _LSLine=66, _LSFunction=_LSServer_GetServerStoreForConnectionWithCompletionHandler}
2022-06-17 18:08:47.290070+0200 DeviceActivityTest[9613:954204] [default] Remote viewcontroller request failed: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service with pid 9615 named com.apple.DeviceActivityUI.DeviceActivityReportService.viewservice was interrupted, but the message was sent over an additional proxy and therefore this proxy has become invalid." UserInfo={NSDebugDescription=The connection to service with pid 9615 named com.apple.DeviceActivityUI.DeviceActivityReportService.viewservice was interrupted, but the message was sent over an additional proxy and therefore this proxy has become invalid.}
Answered by nemecek_f in 718447022

With the beta 2 of iOS 16 and Xcode 14, this now appears to work as expected.

I am experiencing the same issue. I am wondering if this is a bug present in the beta of the API.

Accepted Answer

With the beta 2 of iOS 16 and Xcode 14, this now appears to work as expected.

@nemecek_f

Thank you for the update on it being resolved! I experienced the same initially.

Are there any other features that are not working for you with reports? For example, it doesn't look like app-token-based filtering is working for me?

I am experiencing this issue in Beta 3 again. Is anyone else?

@tjpaul I can't get anything to work properly in Beta 3 - waiting for Beta 4

I still see this issue in Beta 4. Is it working for anyone else?

Has this issue been resolved? Still seeing the issue in Beta 5 and Beta 6.

We are still experiencing this issue in iOS 16 release version. Is anyone else seeing this?

I am dealing with this in January of 2023. Any help would be appreciated!

Leaving this here for the next person who needs help:

lets say you have this in your context:

extension DeviceActivityReport.Context {

    // If your app initializes a DeviceActivityReport with this context, then the system will use

    // your extension's corresponding DeviceActivityReportScene to render the contents of the

    // report.

    static let totalActivity = Self("totalActivity")

}

You have to put this in your actual app AND in your DeviceActivityReport extension.

Does anyone get the solution? Getting same error

I am getting the same error I checked that my extension's deployment target is settled as 16.2 and I am trying to fetch the data on the iPhone device with version 16.1.1 So I just changed the deployment target to 16.0 and it's working fine.

To fix this error, I updated all of my deployment information to version 16.0, including the deployment target and minimum deployment. Additionally, I am using XCode 14.2.

I am experiencing this issue in Xcode 14.2 and os 16.0. Is anyone else?

I am facing this issue Some time timeduration show sometime not show .

Cannot get DeviceActivityReport to work
 
 
Q