I want to display device activity reports for particular selected apps. for getting a daily basis app uses time. Now, what is happening? there are 10 apps selected from the family activity picker but some apps are displayed in the list. I need all 10 apps or more that I will choose from the family activity picker. The bellow code is used for fetching reports.
var body: some View {
VStack {
DeviceActivityReport(context, filter: filter)
}
}
bellow code is used for the filter
@State public var filter = DeviceActivityFilter()
init(selectedApps: Set<ApplicationToken>, selectedCategories: Set<ActivityCategoryToken>, selectedWebDomains: Set<WebDomainToken>) {
self.selectedApps = selectedApps
self.selectedCategories = selectedCategories
self.selectedWebDomains = selectedWebDomains
self.filter = DeviceActivityFilter(
segment: .daily(
during: Calendar.current.dateInterval(
of: .weekOfYear, for: .now
)!
),
users: .all,
devices: .init([.iPhone]),
applications: selectedApps,
categories: selectedCategories,
webDomains: selectedWebDomains
)
}
You can see we selected 3 apps from family activity picker but we getting 2 apps from DeviceActivityReport extension
following code is for device activity report extension
let context: DeviceActivityReport.Context = .totalActivity
// Define the custom configuration and the resulting view for this report.
let content: (ActivityReport) -> TotalActivityView
func makeConfiguration(representing data: DeviceActivityResults<DeviceActivityData>) async -> ActivityReport {
// Reformat the data into a configuration that can be used to create
// the report's view.
var res = ""
var list: [AppDeviceActivity] = []
let totalActivityDuration = await data.flatMap { $0.activitySegments }.reduce(0, {
$0 + $1.totalActivityDuration
})
for await d in data {
res += d.user.appleID!.debugDescription
res += d.lastUpdatedDate.description
for await a in d.activitySegments{
res += a.totalActivityDuration.formatted()
for await c in a.categories {
for await ap in c.applications {
if let apptoken = ap.application.token {
let appName = (ap.application.localizedDisplayName ?? "nil")
let bundle = (ap.application.bundleIdentifier ?? "nil")
let duration = ap.totalActivityDuration
let numberOfPickups = ap.numberOfPickups
let app = AppDeviceActivity(appToken: apptoken, id: bundle, displayName: appName, duration: duration, numberOfPickups: numberOfPickups)
list.append(app)
}
}
}
}
}
return ActivityReport(totalDuration: totalActivityDuration, apps: list)
}
General
RSS for tagDelve into the world of built-in app and system services available to developers. Discuss leveraging these services to enhance your app's functionality and user experience.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I want to display device activity reports for particular selected apps. for getting a daily basis app uses time. Now, what is happening? there are 10 apps selected from the family activity picker but some apps are displayed in the list. I need all 10 apps or more that I will choose from the family activity picker. The bellow code is used for fetching reports.
var body: some View {
VStack {
DeviceActivityReport(context, filter: filter)
}
}
bellow code is used for the filter
@State public var filter = DeviceActivityFilter()
init(selectedApps: Set<ApplicationToken>, selectedCategories: Set<ActivityCategoryToken>, selectedWebDomains: Set<WebDomainToken>) {
self.selectedApps = selectedApps
self.selectedCategories = selectedCategories
self.selectedWebDomains = selectedWebDomains
self.filter = DeviceActivityFilter(
segment: .daily(
during: Calendar.current.dateInterval(
of: .weekOfYear, for: .now
)!
),
users: .all,
devices: .init([.iPhone]),
applications: selectedApps,
categories: selectedCategories,
webDomains: selectedWebDomains
)
}
You can see we selected 3 apps from family activity picker but we getting 2 apps from DeviceActivityReport extension
following code is for device activity report extension
let context: DeviceActivityReport.Context = .totalActivity
// Define the custom configuration and the resulting view for this report.
let content: (ActivityReport) -> TotalActivityView
func makeConfiguration(representing data: DeviceActivityResults<DeviceActivityData>) async -> ActivityReport {
// Reformat the data into a configuration that can be used to create
// the report's view.
var res = ""
var list: [AppDeviceActivity] = []
let totalActivityDuration = await data.flatMap { $0.activitySegments }.reduce(0, {
$0 + $1.totalActivityDuration
})
for await d in data {
res += d.user.appleID!.debugDescription
res += d.lastUpdatedDate.description
for await a in d.activitySegments{
res += a.totalActivityDuration.formatted()
for await c in a.categories {
for await ap in c.applications {
if let apptoken = ap.application.token {
let appName = (ap.application.localizedDisplayName ?? "nil")
let bundle = (ap.application.bundleIdentifier ?? "nil")
let duration = ap.totalActivityDuration
let numberOfPickups = ap.numberOfPickups
let app = AppDeviceActivity(appToken: apptoken, id: bundle, displayName: appName, duration: duration, numberOfPickups: numberOfPickups)
list.append(app)
}
}
}
}
}
return ActivityReport(totalDuration: totalActivityDuration, apps: list)
}
I have an application that has worked fine for years, however on a latest build on Sonoma and the most recent version of Xcode when I run the app I receive errors trying to access a plist file via a shared defaults controller which contains preferences. This used to work but now generates errors that I am trying to access a file outside of the container
I'd appreciate any help understanding what has changed and how I can resolve it. I have heard about a setting allowing read/write access to preferences but cannot find it in Xcode
I've created a control centre widget modelled on the talk in "Extend your app's controls across the system".
In the talk, the user can select which timer they want to start ("work" or "violin").
The specific timer is passed to ToggleTimerIntent as follows:
ControlWidgetToggle(
timerState.timer.name,
isOn: timerState.isRunning
action: ToggleTimerIntent(timer: timerState.timer)
) { isOn in
...
}
However, I can't find a way to access the timer value from inside my ToggleTimerIntent, since this code isn't provided in the talk.
An AppIntent must provide an empty init(), so I've specified timer as an option String:
@available(iOS 18, *)
struct ToggleTimerIntent: SetValueIntent {
static let title: LocalizedStringResource = "Toggle Timer"
// This value isn't never populated.
var timer: String?
@Parameter(title: "Running")
var value: Bool
func perform() async throws -> some IntentResult {
if let timer {
}
else {
// Always here
}
}
}
When I backtrace the code, ToggleTimerIntent is instantiated several times, however perform() is only called on an instance where the timer value isn't provided.
In iOS 18 (beta 1-4) when you set openAppWhenRun = false in your AppIntent of your live activity the perform function never gets called.
In iOS 16 and 17 my live activities work. I have downloaded other apps and in their live activities any button tab which doesn´t open the app is also doing nothing in iOS 18.
Has anyone got this working? Any comments from an Apple engineer on this?
1
I have just added a share extension with an audio predicate, but in the "Files" app, my app doesn’t appear in the "Share" menu for audio files. The Share Activity View Controller does not show my app. There seems to be no way to make it work. I have already spent 2 days googling this and searching forums. Some users say this is an iOS bug, while others suggest restarting the device. Nothing helps.
Just build and run the ShareExtension using the Files app. Try sharing any file and note that my app does not appear in the share list options. I am using the latest iOS 17.5 release version.
2
After starting to implement the sharing feature in my app Anywhere Offline Music Player, I noticed that my phone/iPad freezes when any share dialog from any place in the system is being shown. Additionally, all other apps are missing from the share list. When I try to share a file from any app, the share dialog first appears as a shadow, then glitches, and finally shows up, but the Files app option is missing, so I can't save the shared file. This issue persists even after removing my app, and only a reboot helps. Other users report this happening regardless of whether my app is installed or not.
Sometimes it works without any lags, but mostly it does not. I have no idea what this depends on. The same issue occurs on iPads using the latest beta versions. Removing my app and rebooting the device temporarily "fixes" this.
I've followed the instructions to configure and launch a live caller id test service (https://swiftpackageindex.com/apple/live-caller-id-lookup-example/main/documentation/pirservice/testinginstructions)
i.e. I've constructed a database, built and installed the PIRService etc.
Additionally I have created a test app with a Live Caller ID Extension.
The problem I'm facing is when turning on the Live Caller ID feature on an iPhone (the Settings|Apps|Phone|Call Blocking & Identification|Live CallerID Lookup switch) with iOS 18 Beta 4 is the phone logs:
"The request timed out." UserInfo={NSLocalizedDescription=The request timed out., NSErrorFailingURLKey=http://MacBook-Pro.local:8080/.well-known/private-token-issuer-directory
The configuration notes say:
"When running things locally on your Mac, and your testing device is on the same network, then you can use mDNS to let the device find your Mac. Let’s assume that your Mac’s hostname is Tims-MacBook-Pro.local. Then we should use the following value for the URLs: http://Tims-Macbook-Pro.local:8080. Thanks to the mDNS protocol your device should be able to resolve your hostname to the actual IP address of your Mac and make the connection."
My Mac hostname is "MacBook-Pro" therefore the Live Caller ID Extension is configured as:
LiveCallerIDLookupExtensionContext(
serviceURL: URL(string: "http://MacBook-Pro.local:8080")!,
tokenIssuerURL: URL(string: "http://MacBook-Pro.local:8080")!,
userTierToken: Data(base64Encoded: "BBBB")!
)
And the service-config.json is configured as:
{
"issuerRequestUri": "http://MacBook-Pro.local:8080",
"users": [
<snip>
(I've also tried excluding the issuerRequestUri as the instructions say "This value can be omitted from the configuration. Setting this explicitly will not be required for devices using iOS 18.0 beta 4 or later.")
And the PIR Service is started on the Mac as:
PIRService --hostname 0.0.0.0 service-config.json
And it starts and runs.
The iPhone and Mac are on the same Wifi network and connected by usb cable.
As far as I can tell, everything has been set up in accordance with the Testing Live Caller ID instructions, yet I get the error when attempting to enable the extension on the iPhone.
Is there something missing/incorrectly configured?
I am writing a communication app that relies on the INShareFocusStatusIntentHandling protocol. However, it appears this API is not functional, even with the proper permissions and entitlements.
Given the example code here, I am unable to trigger the logs in the INShareFocusStatusIntentHandling extension.
In this code, when enabling or disabling focus, line 33 of IntentHandler.swift never gets logged, even though FocusStatusCenter is authorized for parent app, UserNotifications authorized for parent app (target), and Communication Notifications entitlement has been added to the parent app. I am also unable to hit any breakpoints in the extension. It seems as if the extension is simply never triggered -- maybe even broken at the OS-level.
I have tried both iOS 17 and the latest 18 beta. Other users have reported similar difficulties in these forums.
To replicate, Install the example app. Give the app UserNotifications and FocusStatus permissions. Background the app. Change focus status. Check console. Notice that the extension handler is never triggered/logged.
Hi,
can I ask you to diagnostic this crash report, please? It started appearing after upgrading to macOs 14.5.
Thanks in advance for your help.
US-16x08_SettingsPanel_crash_report.txt
Topic:
App & System Services
SubTopic:
General
In the documentation for the Contact Provider Extension
contact provider it says
Use the Contact Provider framework if your app manages its own contacts and wants to make them available in other apps that use the Contacts framework.
But how does an app manage its own contacts? What needs to be done differently if it manages its own contacts versus managing a user's contacts? Does the user still need to grant contacts access for example?
Is there a special group/domain that should be used (how) to add app contacts?
There's no mention of any of this that I can see in the documentation for CNContact or CNContactStore.
I know that I can index a maximum of 32767 CSSearchableItem in my application.
Won't there be performance issues in a scenario where each application has the maximum number of indexes? How does the system deal with this situation?
Also, let's say an application indexes the most used 32767 words, won't it abuse the system in this way and be at the top of the search results? What does Apple do about this?
Is there documentation somewhere that specifically details this questions?
How can I disable Dynamic Island interactions while using my app?
A Notification Service Extension is one of the more capable extensions, and there's a lot that can be done within it (for example, it can invoke a Call Extension).
However its not possible to use a Contact Provider Extension within it.
If a CPE has been enabled by the main app, then if a push is sent to the NSE, then within the NSE the ContactProviderManager class reports that the CPE is disabled and its not possible to anything with it. For example a call to ContactProviderManager.signalEnumerator() will hang and not complete.
I was hoping to create a contact and make it available to the system on receipt of a push, but this isn't going to possible.
Is this intentional and by design, or just due to the immaturity of this feature/iOS beta?
The documentation of a Contact provider Extension says:
"signalEnumerator() An example of using this call is to handle a push notification to your app when the provided contacts from your server update"
It therefore seems strange that the main cited use case for ContactProviderManager.signalEnumerator() isn't actually possible if the push is delivered to an extension rather than the app.
I'm developing a workflow extension for Final Cut Pro, but I'm encountering a setback. For some reason, the extension crashes if I launch the app that contains the plugin.
I already added some logic to prevent the app from launching if one is already running, but that didn't fix the issue because the plugin crashes while the app is still loading.
It seems to me that the plugin process is being killed while the app is loading, causing the plugin to crash.
Do you know why this is happening and how to solve it?
Topic:
App & System Services
SubTopic:
General
Tags:
Extensions
macOS
Professional Video Applications
I'm working on developing an AASA for an app that may be built by multiple teams, and I want to create a universal link that opens the app regardless of which team's app is installed on iOS.
Right now the AASA is
{
"applinks":{"apps":[],"details":
[
{"paths":["/abc/*"],"appID":"TEAM1.BUNDLE_ID"},
{"paths":["/abc/*"],"appID":"TEAM2.BUNDLE_ID"},
]
}
}
The AASA works fine for TEAM1, but when the app is built with TEAM2, it does not work (instead redirects to the appstore). I checked the swcutil.txt and it confirms that the is indeed not linked to any domains when built from TEAM2. Is there a known fix for this, or a potential cause?
With iOS 18 there are now five ways for a caller to be blocked/silenced:
the caller can be blocked via the Live Caller ID extension
the caller can be blocked via the Call Kit extension
the caller can be blocked via Block Caller via the call history recents
the call could be silenced via Silence Junk Callers
the call could be silenced via Silence Unknown Callers
These are all totally separate and there's no way of reconciling all of them and presenting a holistic overview and management system to the user.
Call blocking applications have no way of knowing which numbers will be blocked by 3) or silenced by 4) or 5), or even of determining 4) and 5) are enabled.
And iOS doesn't indicate to users what will be blocked by 1) or 2).
Currently users have no way of knowing what's been blocked/silenced where. Neither via call blocking apps nor via the OS.
From users' perspectives its a confusing and frustrating mess.
If the OS exposed which numbers have been blocked via 3) to applications and exposed if Silence Unknown Callers and Silence Junk Callers are enabled then call blocking applications could present a unified way for users to see and manage what's going on with their device holistically.
The bluetooth toggl isn’t working
Topic:
App & System Services
SubTopic:
General
I've been following the instructions on how to set up Live Caller ID Lookup using the example PIRService.
And I have been successful - I'm managed to get name information and images retrieved and displayed on the call screen, in addition to being able to block numbers via PIRService too.
So while I did get it working, it was, and still is, incredibly painful to do so due to the fact it only works about 1% of the time.
There's two main problems, which look like they're different manifestations of the same issue. The first problem is difficulty enabling the Live CallerID lookup feature via the flip switch in the iPhone's settings, and then the second issue is when this has been enabled, then a phone number's details is being attempted to be retrieved.
There's a lot, a very lot, of timeout issues being reported by CallKit logging i.e.:
configure failed Error Domain=com.apple.CipherML Code=1100 "Unable to query status due to errors: The request timed out." UserInfo={NSLocalizedDescription=Unable to query status due to errors: The request timed out., NSUnderlyingError=0xd98344450 {Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo={NSLocalizedDescription=The request timed out., NSErrorFailingURLKey=http://192.168.1.100:8080/issue}}}
When this occurs I can see that the request is getting through to the PIRService as it outputs logging to the Mac console:
2024-07-28T09:33:15-0700 info Hummingbird : [HummingbirdCore] Server started and listening on 0.0.0.0:8080
2024-07-28T09:33:37-0700 info Hummingbird : hb_id=5e0330c893af6a98c20e5100fdb26871 hb_method=GET hb_uri=/.well-known/private-token-issuer-directory [Hummingbird] Request
2024-07-28T09:33:37-0700 info Hummingbird : hb_id=5e0330c893af6a98c20e5100fdb26872 hb_method=GET hb_uri=/token-key-for-user-token [Hummingbird] Request
So it would appear that requests are getting through to PIRService but then something is timing out after that. Could that be the PrivacyPass/Homomorphic Encryption stuff? Or something else?
What could be a cause of this instability, and is there anything that can be done to increase reliability of it?
(Xcode 16 beta 4, iOS 18 developer beta 4, Sonoma 14.5, the iPhone(s) being tested are connected to the Mac via usb cable, running on the same Wifi network).
Our team has recently added support to our app for Live Activities where the source of the data is driven from the app itself (not push notifications).
We've noticed a crash happening in our core data code caused by the following error thrown by the addPersistentStore function where it would attempt to recover and eventually crash. Here's an error we created to help us debug that contains the error details:
Domain: CoreData Code: 1 NSLocalizedDescription: Error performing migration for databaseName=mydb.sqlite. Error details=The file couldn’t be saved because you don’t have permission. - userinfo: ["reason": No permissions to create file; code = 1]
After some trouble shooting, we managed to reproduce the issue by doing a hard reboot while we're running a live activity. It appears that when the device starts back up, the Live Activity starts which triggers the app to hit didFinishLaunchingWithOptions which is where we get our Core Data store initialized.
The problem is that our app uses Data Protection using NSFileProtectionCompleteUntilFirstUserAuthentication and we'd prefer to keep it that way.
The Core Data db is present in the app sandbox and we're also seeing logs to suggest a failure trying to access NSUserDefaults as well.
Is there an accepted solution for this? Is it expected that a Live Activity would cause an application to launch prior to the device being unlocked for the first time? Is there a way to change that?
Hello!
I have noticed this in Sonoma and in the betas for Sequoia, the ARM variants. I am using the example from https://github.com/sveinbjornt/hear?tab=readme-ov-file in an attempt to cobble together an all-in-one transcription and low-level grammar checker utilizing LanguageTool.
I have noticed that the ram usage, specifically the swap, just keeps on climbing while it is processing an audio file. It is... quite amazing to see exactly how much swap the dang thing can use in a pinch. Frighteningly so considering the Mini I am using only has 256gb of storage.
Throw an eight hour mp3 audiobook at the process and see for yourself.
I am aware that localspeechrecognition wasn't really designed with the idea that people will be throwing audio files at it, so it is understandable that it wouldn't be equipped to gracefully handle this situation.
I am a novice programmer here. Seriously - this is my first major stab at programming since dabbling with Qbasic back in elementary school. Thus, this question: if there is a memory leak, is there a way to shunt the swap being used by the app to an external drive? I am willing to take the performance hit if it keeps the internal SSD from paying the ferryman sooner than expected due to excessive swap usage.
Thanks!