Post

Replies

Boosts

Views

Activity

Reply to Any workaround for expanding a large category in FamilyActivityPicker?
IMPORTANT Hi, everyone. I’m the owner of this post. Thank you for sharing issues with the family activity picker! I believe providing feedback through Feedback Assistant is the most important thing to raise the task priority of this issue (bug fix) within Apple @Engineer team. If you haven’t submitted a report yet, please do! It’s the only way to resolve this significant problem. After submitting, please add a comment with your feedback ID to the accepted and Apple-recommended reply.
Topic: App & System Services SubTopic: General Tags:
Feb ’25
Reply to DeviceActivityMonitor - Callbacks not trigger
Hi, I've faced a unexpected behavior in my screen time app (AppStops) when using structured concurrency tools in non-isolated DeviceActivityMonitor class. This changes may solve your problems. Remove @MainActor from AppUsageManager Remove Task from your codes. I recommend you to use non-isolated types and methods for DeviceActivityCenter. I hope this helps.
Topic: App & System Services SubTopic: General Tags:
Jan ’25
Reply to How do I persist the Family Activity Picker?
Hi! I’m a developer and I’ve released a screen time app named AppStops. localizedDisplayName and bundleIdentifier are very privacy-sensitive properties. Apple does not allow them to be retrieved outside of the ShieldConfigurationDataSource with ShieldConfiguration App Extension target. In the host target, they always return nil, so this might be the source of your issue. Description of Application.localizedDisplayName is bellow: In an extension that provides shield configurations, this property provides the app’s name. When you access this property outside that extension, the value is nil. See ShieldConfigurationDataSource in the Managed Settings UI framework for more information. https://developer.apple.com/documentation/managedsettings/application/localizeddisplayname I hope this post helps you ☺️
Topic: App & System Services SubTopic: General Tags:
Jan ’25
Reply to Problem with DeviceActivitySchedule and DeviceActivityMonitor
Have you already solved this problem? Your startBlocking code is "returned" without setting the shield. Changing the code order may solve it! @discardableResult private func startBlocking() -> Int { print("number of unique apps") // Set the shield before `return` statement. store.shield.applicationCategories = .all() // Returns the value after setting the shield. return 51 // return exceptions.count }
Topic: App & System Services SubTopic: General Tags:
Jan ’25
Reply to Any workaround for expanding a large category in FamilyActivityPicker?
For people who want to show an alert as soon as possible after the FamilyActivityPicker has crashed, I'll share my workaround ! Workaround struct MyView : View { let stateUpdateTimer = Timer.publish(every: 1, on: .main, in: .common).autoconnect() @State private var updateFlag: Bool = false var body : some View { ZStack { Text(verbatim: "A") // This should not be empty. .foregroundStyle(.clear) .accessibilityHidden(true) .opacity(updateFlag ? 1 : 0) ContentUnavailableView(...) FamilyActivityPicker(...) } .onReceive(stateUpdateTimer) { _ in updateFlag.toggle() } } } Description At first glance, it looks like the FamilyActivityPicker has frozen, but I realized that it simply doesn’t redraw. Therefore, if there is an event that triggers a redraw, it will quickly transition to a transparent after the crash. The above code forces a view update every second by toggling the opacity of a view that is completely irrelevant to the user. This let the FamilyActivityPicker transition to a transparent and immediately show an alert in ZStack. Good Points This workaround doesn't touch any private API and private class. It relies only on public APIs and minimal code, therefore It will continue to work without issues even if the internal implementation is changed in the future.
Topic: App & System Services SubTopic: General Tags:
Sep ’24
Reply to Xcode NSMetaDataQuery error on device running IOS 17.5 - [ERROR] couldn't fetch remote operation IDs
@Onymacris, I could solve the problem! Error messages are still shown, but I guess that the query and error messages are separate, and not related problem. I've moved calling my startQuery method from RootView.task to RootView.onAppear. struct MyApp : App { var body: some Scene { WindowGroup { RootView() .onAppear { startQuery() } } } } This works fine! Only delaying the call may solve the query problem. In Apple official sample, it starts query at viewDidLoad(). It is not so fast timing.
Aug ’24
Reply to Xcode NSMetaDataQuery error on device running IOS 17.5 - [ERROR] couldn't fetch remote operation IDs
I have experienced the problem too, in my iOS 17.5.1 physical device. My predicate is metadataQuery.predicate = NSPredicate(format: "%K LIKE %@", NSMetadataItemFSNameKey, "*.json"). What Xcode says: "[ERROR] couldn't fetch remote operation IDs: NSError: Cocoa 257" "Error returned from daemon: Error Domain=com.apple.accounts Code=7 "(null)""
Aug ’24
Reply to How much time is AppIntent.perform() method given?
In addition to my testing that 20~30 seconds are given to perform(), I've found an apple official comment about how much perform()method is given in Responding to the Action button on Apple Watch Ultra Then, implement your intent’s perform() method. The system calls this method when anything triggers the intent. In your implementation, you have 30 seconds to start a workout session and return a successful value. If you don’t start a workout session in that time, the system displays an error message, but the app remains in the foreground. People can start a workout session directly from the app, but without a session, the app goes to the background the next time they drop their wrist In the documentation, Apple says workout intent's perform() has 30 seconds.
Topic: App & System Services SubTopic: General Tags:
Mar ’24
Reply to BUG: Broken NavigationStack when .bottomBar and back-half-swipe
My Workaround func bottomBarAlternative<V>(@ViewBuilder _ content: () -> V) -> some View where V : View { self.safeAreaInset(edge: .bottom) { HStack { content() } .labelStyle(.iconOnly) .imageScale(.large) .padding() .frame(maxHeight: 50) .background(Material.ultraThinMaterial) .overlay { VStack(spacing: 0) { Divider() Spacer() } } .accessibilityElement(children: .contain) .accessibilityLabel("Toolbar") } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Oct ’23
Reply to New NSSearchToolbarItem in Mac Catalyst
Good news for you! Today, iPadOS with catalyst automatically translates navigationItem.searchController to AppKit native NSSearchToolbarItem. (However, only automatic-translation support AppKit native component. It is not available with manual NSToolbar. Please check the wwdc session. https://developer.apple.com/videos/play/wwdc2022/10076/ A public sample project is here https://developer.apple.com/documentation/uikit/app_and_environment/supporting_desktop-class_features_in_your_ipad_app.
Topic: App & System Services SubTopic: General Tags:
Aug ’22
Reply to Can an App detect a subscription's cancellation in itself?
Fortunately, I found a solution! A @MainActor static func showManageSubscriptions(in scene: UIWindowScene) async throws suspends the task until the user selects "Done" or "Cancel" in the manage subscription screen, so you can manually check the updated state in the next line. Task {     do { // The method suspends the execution until the user selects "Done" or "Cancel"         try await AppStore.showManageSubscriptions(in: view.window!.windowScene!) // The line is executed after dismissing the screen. You can check the latest state of your app's subscription, then update your UI.         await checkAndUpdateAppSubscriptionStateI()      } catch let storeKitEerror as StoreKitError { // Error handling      } }
Topic: App & System Services SubTopic: StoreKit Tags:
Jul ’22