Hello,
I'm working on an app that makes use of Screen Time features by leveraging the Family Controls, Device Activity and Managed Settings frameworks.
The main app works fine by shielding/unshielding apps with a toggle.
When it comes to monitoring the time intervals with the Device Activity Monitor (DAM) extension (e.g. lock X apps for Y minutes), I'm experiencing several issues.
To shield/unshield apps and kick off the monitoring I perform the following instructions:
let timeInMinutes = 15
let startDate = Date(timeIntervalSinceNow: 1.0) // padding added to avoid invalid DAM ranges < 15 mins.
let endDate = startDate.addingTimeInterval(timeInMinutes * 60.0)
let components: Set<Calendar.Component> = [.day, .month, .year, .hour, .minute, .second]
let calendar = Calendar.current
let intervalStart = calendar.dateComponents(components, from: startDate)
let intervalEnd = calendar.dateComponents(components, from: endDate)
let schedule = DeviceActivitySchedule(intervalStart: intervalStart, intervalEnd: intervalEnd, repeats: false)
try deviceActivityCenter.startMonitoring(.definiteShield, during: schedule)
let managedSettingsStore = ManagedSettingsStore()
managedSettingsStore.shield.applications = selection.applicationTokens // `selection` being an instance of `FamilyActivitySelection`
The main pain points are:
After this code is performed, I would expect the Device Activity Monitor extension to start, or at least to start once I go to background. To check whether the DAM extension is running or not, I attach to the extension process manually (Product > Attach to Process by PID or Name). But I can see the extension correctly running only after 3-4 attempts of calling startMonitoring.
Even when the DAM extension runs, intervalDidStart and intervalDidEnd methods in the extension are called quite randomly - most of the times not being called at all - thus making the extension hugely unaffordable.
Please note:
I already ask for Screen Time permissions during the onboarding by calling AuthorizationCenter.shared.requestAuthorization(for: .individual), so by the time the user shields the apps, these permissions are already granted.
I already have Family Control entitlements for development and distribution, and for both the main target and the DAM extension target.
In the intervalDidEnd method, I simply call ManagedSettingsStore().clearAllSettings() and DeviceActivityCenter().stopMonitoring(). This looks like to be enough to stay way below the 6MB memory limit.
Am I doing something wrong, is there a way to fix this, or is just the Device Activity framework that is unstable?
Post
Replies
Boosts
Views
Activity
Hello everyone,
I’m experiencing an issue with App Clips Advanced Experiences and Apple Maps/Siri Suggestions. We have already contacted Apple Support before, but they are investigating the cause of this issue and it has not been resolved til date.
The App Clip is bundled with the main app and has been already available on the App Store for several months. The business running the app has several physical shops and wants to offer the App Clip to show up in Apple Maps and Siri Suggestions at each location.
The App Clip is correctly exposed in the AASA file, and it's also validated correctly by the AASA APIs available at https://app-site-association.cdn-apple.com/a/v1.
{
"applinks": {
"apps": [],
"details": [
{
"appID": "TEAMID.bundleid",
"paths": []
}
]
},
"appclips": {
"apps": [
"TEAMID.bundleid.Clip"
]
}
}
(with TEAMID and bundleid being the team and bundle identifiers of the app)
The App Clip is displayed correctly when loading the website and when scanning a QR code or App Clip code, but doesn't appear in the Maps app or in Siri suggestions.
We have set up the App Clip Advanced Experiences on the App Store Connect page of the app, and each URL has been linked to a physical shop. All URLs are in the "Received" state, so they should appear correctly on Maps.
Unfortunately, I don't see any "Order" button in Apple Maps at any location card. We tried with both iOS 17 and 16. According to feedbacks from people in the shops, they don't see the app suggested in the Siri Suggestions.
I have just submitted a Custom Action Link on Apple Business Connect for one of the shops, but without success: the App Clip doesn't appear.
Any idea why is this happening?