Post

Replies

Boosts

Views

Activity

How to use Family Controls in Mac Catalyst? Sandbox restriction
Hey, I am trying to use Family Controls in Mac Catalyst. On the iOS app it works fine. On macOs using Mac Catalyst it builds fine but I get following console output. Failed to get service proxy: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.FamilyControlsAgent was invalidated: failed at lookup with error 159 - Sandbox restriction." UserInfo={NSDebugDescription=The connection to service named com.apple.FamilyControlsAgent was invalidated: failed at lookup with error 159 - Sandbox restriction.}` When i try to open the FamilyActivityPicker on the macOs app following error is displayed in the GUI. The operation could not be completed. (FamilyControls.ActivityPickerRemoteView Error error 2.) Do I need a familyControls capability for macOs? If yes, I only find it for iOS. Thanks for hints and help :)
1
0
869
Apr ’24
In DeviceActivityReportScene count numberOfPickups for given Application
How can I count the number of pickups for a certain application? The docs say that there is a struct ApplicationActivity within the DeviceActivityData: https://developer.apple.com/documentation/deviceactivity/deviceactivitydata Using this code I receive a warning in XCode: Value of type 'DeviceActivityData' has no member 'applicationActivity' struct ApplicationPickupCountReport: DeviceActivityReportScene { // Define which context your scene will represent. let context: DeviceActivityReport.Context = .applicationPickupCount // Define the custom configuration and the resulting view for this report. let content: (String) -> ApplicationPickupCountView func makeConfiguration(representing data: DeviceActivityResults<DeviceActivityData>) async -> String { var totalPickups = 0 let totalPickups = await data.flatMap { $0.applicationActivity }.reduce(0, { $0 + $1.numberOfPickups }) return "\(totalPickups)" } }
0
0
482
Mar ’24
Open NavigationLink from Local Notification in NavigationStack iOS17
The Notification provides the uuid corresponding to the Item saved in SwiftData. Goal is to open the correct DetailItem View when I tap the notification. How can I achieve this? @Model final class Item { @Attribute(.unique) var uuid: UUID ... } -- extension LocalNotificationManager: UNUserNotificationCenterDelegate { func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse) async { guard let userInfo = response.notification.request.content.userInfo["uuid"] as? Data else { print("No data found in notification userInfo") return } } -- struct ItemList: View { @Query var items: [Item] @State private var path = NavigationPath() var body: some View { NavigationStack(path: $path) { ForEach(Array(items.enumerated()), id: \.element.id) { index, item in NavigationLink(value: item) { ItemButton(item: item, index: index) } } } }.navigationDestination(for: Item.self) { item in DetailItem(item: item) } }
0
0
518
Mar ’24
SwiftUI NavigationBar using UIHostingController does not Display correctly until NSLayoutConstraint is broken
I'm facing an issue where the navigation bar title of a SwiftUI view does not display correctly on the first render. It only appears correctly after switching to another tab and then coming back. Alongside this issue, I'm receiving the following constraint error in the console: `[UIKitCore] Unable to simultaneously satisfy constraints. Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) ( "<NSAutoresizingMaskLayoutConstraint:0x6000021d2a30 h=-&- v=--& Test.minY == 0 (active, names: Test:0x11560c7c0, '|':UILayoutContainerView:0x11560e180 )>", "<NSAutoresizingMaskLayoutConstraint:0x6000021d08c0 h=-&- v=--& Test.height == 96 (active, names: Test:0x11560c7c0 )>", "<NSLayoutConstraint:0x6000021d70c0 V:[Test]-(0)-[UIFocusContainerGuide:0x600003deab20'UINavigationControllerContentFocusContainerGuide'] (active, names: Test:0x11560c7c0 )>", "<NSLayoutConstraint:0x6000021d61c0 UIFocusContainerGuide:0x600003deab20'UINavigationControllerContentFocusContainerGuide'.bottom == UILayoutContainerView:0x11560e180.bottom (active)>", "<NSLayoutConstraint:0x6000021c6bc0 'UIView-Encapsulated-Layout-Height' UILayoutContainerView:0x11560e180.height == 0 (active)>" ) Will attempt to recover by breaking constraint <NSLayoutConstraint:0x6000021d70c0 V:[Test]-(0)-[UIFocusContainerGuide:0x600003deab20'UINavigationControllerContentFocusContainerGuide'] (active, names: Test:0x11560c7c0 )> Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger. The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.` SwiftUI View struct ContentView: View { var body: some View { NavigationStack { ScrollView { VStack(spacing: 20) { ForEach(0..<10) { index in VStack { Text("Section \(index)").font(.headline).padding() ForEach(0..<5) { itemIndex in Text("Item \(itemIndex)").padding() } } .frame(maxWidth: .infinity) .background(Color.gray.opacity(0.2)) .cornerRadius(10) .padding(.horizontal) } } }.navigationTitle("Overview").navigationBarTitleDisplayMode(.automatic) } } } ExpoView extends ... extends UIView class ExpoContentView: ExpoView { required init(appContext: AppContext? = nil) { super.init(appContext: appContext) self.backgroundColor = .white // Init the view controller let contentView = ContentView() let hostingController = UIHostingController(rootView: contentView) setupHostingController(hostingController) func setupHostingController(_ hostingController: UIHostingController<some View>) { hostingController.view.translatesAutoresizingMaskIntoConstraints = false hostingController.view.backgroundColor = .clear addSubview(hostingController.view) NSLayoutConstraint.activate([ hostingController.view.topAnchor.constraint(equalTo: self.topAnchor), hostingController.view.bottomAnchor.constraint(equalTo: safeAreaLayoutGuide.bottomAnchor), hostingController.view.leadingAnchor.constraint(equalTo: safeAreaLayoutGuide.leadingAnchor), hostingController.view.trailingAnchor.constraint(equalTo: safeAreaLayoutGuide.trailingAnchor) ]) } } How can I achieve that it is correctly shown at the first render?
0
0
694
Mar ’24