Is there anything that can be done to speed up the execution of a Shortcut?
There is a Shortcut that many users opt to use with my app that is only effective if it runs immediately - the reality, though, is that it often takes 1-2 seconds for the Shortcut to trigger, rendering it largely useless (the Shortcut is meant to prevent users from being able to disable Screen Time in Settings).
Has anyone had success with this, and/or are there other approaches we could be taking?
Post
Replies
Boosts
Views
Activity
My app allows users to select apps and websites to block using the Screen Time API. Lately I have gotten a bunch of emails from users who say that selecting one app also results in other apps of that family being blocked, even if they aren't selected in the FamilyActivityPicker.
The most common example is Facebook. A handful of users have said that they selected Facebook to be blocked, but Messenger will be blocked as well (even though Messenger isn't selected, and they don't want it to be blocked).
Does anyone know why this might be happening? It seemed to begin happening awhile ago after allowing users to block websites in addition to apps - not sure if that could have something to do with it.
I have a couple of questions on the FamilyActivityPicker that I couldn't seem to find in the documentation:
Is there any way to have it show only apps or websites? I've had some users reach out with frustrations because they want to select a category of apps (e.g. "Social"), but that also selects a lot of websites that they don't want to include.
Where does the picker get the websites that it populates? It seems like there's not much rhyme or reason to these (and there's often multiple urls for the same site - e.g. facebook.com and m.facebook.com).
Is there any way (as a developer) to have preset app selections available upon download? For example, can I have an option that has certain apps in the Social category chosen by default so that each user doesn't have to go in and manually select all of the apps they want?
It seems that the first time I open my app after the phone is restarted, the app does not properly access UserDefaults.
When my app is launched, I pull relevant user settings / preferences from UserDefaults. I recently noticed (after some users reached out about issues) that the first time the app is opened after a restart, the app appears as though all user settings / preferences have been erased.
If the app is force quit and reopened, the user data seems to come back normally. If the user takes action in the app before force quitting, though, UserDefaults will be written to with these new, empty values (essentially erasing what used to be in UserDefaults).
This makes it seem as though right after the phone is restarted, the app is unable to pull data from UserDefaults for some reason. Has anyone else seen this issue?
It could also be due to the lifecycle of my app and how I access UserDefaults, so if others don't have this issue it would be great to hear how you handle this.
I use UserDefaults to store a variety of user data / preferences. Recently, I have started getting somewhat frequent complaints from users that their settings have been reset.
There doesn't appear to be a rhyme or reason to the issue (some users have all of their data reset just once, while others are seeing that one of their settings resets very frequently).
I haven't been able to pinpoint what the root cause is, but I figure that it must have something to do with UserDefaults (either all of it or only certain keys) somehow getting erased.
As I figure out the root cause, I figure that a good solution in the meantime is to backup UserDefaults in some way (e.g. perhaps to iCloud?).
Is there a standard / best-practice way of doing this?
Is there a way for me to programmatically check whether a user has disabled my app's access to Screen Time?
I currently request Family Controls / Screen Time access upon download by calling the following:
AuthorizationCenter.shared.requestAuthorization(for: .individual)
I need to be able to detect, though, when a user has gone into Settings -> Screen Time and disabled my app's Screen Time access. I tried calling the following:
AuthorizationCenter.shared.authorizationStatus
But it appears to have a value of Approved even after I turn off my app's Screen Time access.
Is there any way to accurately detect this in the code?
If a user sets up a Shortcut to execute when the Settings app is opened, it will only trigger if the Settings app is opened from the home screen.
If, though, the user opens settings through the Control Center (e.g. by holding down on Wi-Fi and tapping "Wi-Fi Settings..."), it will open the Settings app but not trigger the Shortcut.
Is there any way to fix this?
Our users report frequent crashes with the FamilyActivityPicker. Since this is a screen controlled by Apple, I'm assuming that there's nothing I can do to prevent these crashes.
I'm wondering, though, if there's any way to gracefully handle these crashes? When this happens, the following is printed to the console:
[com.apple.FamilyControls.ActivityPickerExtension(1121)] Connection to plugin invalidated while in use.
Does anyone know how to handle/catch this error?
I have implemented an AppIntent in my app with the purpose of allowing users to set up an automation within the Shortcuts app that runs based on a boolean value in my app.
It works well normally, but I've found that if my app is force quit, the Shortcut no longer works (presumably because it can't fetch the value of the boolean from my app anymore).
Does anyone know how to persist this value so that the Shortcut will work regardless of whether my app is open in the background?
Here is my implementation of the AppIntent:
struct my_automation: AppIntent {
static var title: LocalizedStringResource = "Automation Name"
var isTrue = UserDefaults.standard.bool(forKey: "myVal")
func perform() async throws -> some IntentResult {
return .result(value: isTrue)
}
}
If a user has Screen Time limits set up for certain apps, will that interfere with my app that allows users to restrict app usage using the Screen Time API?
I've had some users experiencing this issue (they have Screen Time limits set up for apps, and my app isn't able to restrict those and/or other apps), but I haven't been able to find a reliable pattern yet. Has anyone else encountered this?
My app uses the ScreenTime API to allow users to block other apps. For some users, the FamilyActivityPicker doesn't render any apps, and they aren't able to block anything.
When they go into Settings -> Screen Time, there is no section titled "Apps With Screen Time Access", and when they go into Settings -> , there is no toggle for Screen Time Restrictions - even though they enabled screen time access when setting up my app.
Has anyone else seen this issue and/or resolved it?
Is there any way to show the user system apps in the FamilyActivityPicker? Specifically, I am asking about Safari.
I am working on an app that allows users to block other apps, and I am trying to figure out whether I can make this functionality available for Safari.
The Screen Time API allows developers to block / shield all apps that aren't in the user's "Always Allowed" list in the Screen Time settings (by setting .all() for ShieldSettings.ActivityCategoryPolicy.
What I've found, though, is that if an app is blocked, the user can simply go to this Always Allowed list, add that app, and it immediately becomes unblocked.
I am trying to either prevent a user from being able to do this or detect when a user does this, as the point of an app like mine (that allows the user to block other apps) is to prevent people from easily accessing those apps that are blocked. Is this possible?
Is there any reliable way to persist some app data after the user deletes the app, so that the next time they download it again the data will still be accessible?
For a variety of reasons, I do not currently want to require users to create accounts and then store that data on an external server - I am just storing all app data in UserDefaults. If a user deletes the app, though, it is important that if a user redownloads it certain datapoints would be accessible from the last time they used it.
I have done a bit of research and it looks like Keychain can persist data after app deletion, but it seems like that might not be optimal (as it's meant more for things like passwords).
Are there any other solutions I should try, or is it inevitable that I will need to require users to create accounts and then store this information in a backend I manage?
This may be a bit high level, but wanted some clarification as I can't be sure from reading the documentation.
I am considering adding paid subscriptions into my app at some point in the future. Initially, though, I would like the app to simply be free to use.
Even though I won't be charging subscriptions right away, would it make sense to implement the mechanics for subscriptions into the app right away for each user (and simply have the subscription be $0/month, for example)?
Or will it be easy enough in the future to add the option for a paid subscription and integrate it seamlessly with existing users?
To provide some additional context, I don't want to implement any sort of custom account creation / registration logic into my app (i.e. like on a social media where each user creates a username and password) - I would simply like to be able to utilize Apple's logic for Apple IDs and such to eventually handle payments and subscriptions. Is this something I should reconsider?