Post

Replies

Boosts

Views

Activity

Archive Missing Bundle Identifier Error - IDEArchivedApplicationErrorDomain
Hello everyone, I’m encountering an issue while trying to archive my app in Xcode, and I hope someone can help me troubleshoot it. Error Details: Domain: IDEArchivedApplicationErrorDomain Code: 1 Failure Reason: Archive content at path /Users/c1/Library/Developer/Xcode/Archives/2024-09-22/alpha release 4 22-09-24, 2.52 PM.xcarchive/Products/Applications/Runner.app is missing a bundle identifier. User Info: DVTErrorCreationDateKey = "2024-09-22 09:22:03 +0000"; Steps Taken: I’ve verified that the Bundle Identifier is correctly set in the project settings under the General tab. Cleaned the build folder (Product > Clean Build Folder). Restarted Xcode and attempted to archive again. Checked that all targets in the project have a valid Bundle Identifier. Has anyone experienced a similar issue or have any suggestions for resolving this? I would appreciate any guidance on how to fix this missing bundle identifier error. Thanks in advance for your help!
0
0
331
Sep ’24
Checking Equality of ApplicationToken Instances in Swift
Hi everyone, I'm working on a Swift application and trying to determine whether an application has exceeded its limit based on an ApplicationToken. I have the following function to check if the current app's token matches any of the tokens stored when the app limit is reached: private func isAppLimitExceeded(for application: Application?) -> Bool { guard let application = application, let appToken = application.token else { return false } let exceededTokens = configManager.getAppLimitExceededTokens() return exceededTokens.contains { exceededToken in appToken == exceededToken } } The function configManager.getAppLimitExceededTokens() returns a list of [ApplicationToken] that were saved in UserDefaults when an app limit is reached. The goal is to use the isAppLimitExceeded method to verify if the current shield for the app is triggered due to a limit/threshold being exceeded. This function is part of a class that conforms to the ShieldConfigurationDataSource protocol: class ShieldConfigurationExtension: ShieldConfigurationDataSource { // ... } My concern is whether comparing two ApplicationToken instances using == is a reliable method for determining if they are equal. Are ApplicationToken objects guaranteed to be comparable with == out of the box, or do I need to implement Equatable or another method of comparison? Could there be issues with tokens stored in UserDefaults not matching due to reference or serialization differences? Any guidance on how to ensure proper comparison of these tokens would be appreciated! Thanks!
2
0
371
Sep ’24
Differentiating and Displaying Screen Time Data for Individual Children in App
Hi everyone, I’m developing a parental control app using Apple's ScreenTime API, and I need to display ScreenTime data separately for each child in a family. The API offers options like .children and .all, but I’m looking for the best way to reliably filter and show data for a single child within the app. I’ve seen other apps like Ohana successfully implement this feature, even the apple official family screen time feature has this where parents can view ScreenTime data for each child individually. I want to achieve a similar experience in my app, ensuring that if a parent selects "John," the app only displays John's ScreenTime, without mixing in data from his siblings. Here’s the approach I’m considering using DeviceActivityFilter and DeviceActivityReport to target data for a specific child: let filter = DeviceActivityFilter( segment: .children, intervals: .everyDay ) let report = DeviceActivityReport( filter: filter ) { (data) in // Process and separate data for each child if let activityData = data as? DeviceActivityReportData { for child in activityData.children { if child.name == "ChildName" { // Replace "ChildName" with the actual child's name or identifier // Access and display data for the specific child print("Child: \(child.name), Screen Time: \(child.screenTime)") } } } } Context: Goal: I need to ensure parents can view ScreenTime data for each child individually, similar to how Ohana does it. For example, selecting "John" should display only John's ScreenTime. Challenge: While some data can be grouped within the DeviceActivity extension, I'm not entirely sure if this approach with DeviceActivityFilter is the most reliable way to isolate and display data for a single child. Has anyone implemented a similar solution? Are there any alternative methods or best practices that could improve the accuracy and reliability of this filtering? Any advice or examples would be greatly appreciated! Thanks!
3
0
360
Aug ’24
Integrating Two Separate Apps for Parental Control: Queries on Family Picker, Filtering, and Screen Time Permissions
Hello Apple Developer Community, We have developed two totally separate apps for parental control: one for parents (xyz/parent.com) and one for children (abc/child.com). These are not two sides of the same app, but rather distinct applications. Recently, we integrated these two apps and encountered a few challenges and questions that we hope the community can help with. Family Picker Behavior: We noticed that only the parent app on the current device is displayed in the Family Activity Picker. Is this the intended behavior? Our expectation was that the Family Activity Picker would show both the parent and child apps available on the device. Is there a way to ensure that both types of apps are listed? Filtering Apps in Family Picker: Is it possible to filter the apps displayed in the Family Activity Picker to show only the child’s app and exclude the parent app? Our goal is to streamline the selection process for users by removing irrelevant apps from the picker. If direct filtering is not possible, are there any recommended workarounds or best practices to achieve a similar result? Screen Time Permission Requirements: We’ve successfully implemented screen time permissions using the Authorization Center for the child app. However, do we also need to request screen time permissions from within the parent app? If so, are there any specific guidelines or best practices for managing screen time permissions across two interconnected apps? Triggering Child Managed Settings from Multiple Apps: Is it feasible to trigger managed settings (e.g., enabling restrictions) for the child app from both the parent and child apps? We want to ensure consistent enforcement of settings regardless of which app initiates the change. Are there any limitations or conflicts we should be aware of when managing settings from two different apps? We appreciate any guidance or insights you can provide on these issues. We’ve referred to the Family Controls and Screen Time documentation, but we're seeking more specific advice related to the integration of two separate apps in this context. Thank you in advance for your help!
0
0
349
Aug ’24
Issues with Silent Notifications in Parental Control App Using FCM and Background Tasks
Hello, We are developing a parental control app consisting of two parts: a parent app to manage settings and a child app to enforce these settings using iOS's Screen Time API, CoreData, and other components. We've attempted to use silent notifications with Firebase Cloud Messaging (FCM) to communicate updates from the parent app to the child app. Our current implementation involves background modes for remote messages and background tasks. However, we're facing a challenge: while normal FCM push notifications with a 'message' key work as expected, silent notifications (with only a 'data' key) do not trigger the desired behavior in the child app, even though FCM returns a success response. We're looking for assistance with two main issues: Alternative Approaches: Is there a better way to notify the child app of changes? We're considering a system where the child app periodically checks for updates via API and then updates CoreData and managed settings. Any recommendations for this architecture or a more reliable notification system would be greatly appreciated. Debugging Silent Notifications: If our current approach using silent notifications is feasible, could someone help us debug why these notifications are not working as expected? We've been stuck on this for a week, and any help would be a lifesaver. Here's the relevant part of our AppDelegate code: import UIKit import FirebaseCore import FirebaseMessaging import BackgroundTasks @objc class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate { let gcmMessageIDKey = "gcm.message_id" let backgroundTaskIdentifier = "com.your-company.your-app.silentnotification" func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { FirebaseApp.configure() Messaging.messaging().delegate = self // Register for remote notifications UNUserNotificationCenter.current().delegate = self application.registerForRemoteNotifications() // Register background task BGTaskScheduler.shared.register(forTaskWithIdentifier: backgroundTaskIdentifier, using: nil) { task in self.handleBackgroundTask(task: task as! BGProcessingTask) } return true } // Handle incoming remote notifications func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) { if let aps = userInfo["aps"] as? [String: Any], let contentAvailable = aps["content-available"] as? Int, contentAvailable == 1 { // This is a silent notification handleSilentNotification(userInfo: userInfo, completionHandler: completionHandler) } else { // This is a regular notification Messaging.messaging().appDidReceiveMessage(userInfo) completionHandler(.newData) } } // Handle silent notification func handleSilentNotification(userInfo: [AnyHashable: Any], completionHandler: @escaping (UIBackgroundFetchResult) -> Void) { let request = BGProcessingTaskRequest(identifier: backgroundTaskIdentifier) request.requiresNetworkConnectivity = true do { try BGTaskScheduler.shared.submit(request) performAPICall { result in switch result { case .success(_): completionHandler(.newData) case .failure(_): completionHandler(.failed) } } } catch { completionHandler(.failed) } } // Handle background task func handleBackgroundTask(task: BGProcessingTask) { task.expirationHandler = { task.setTaskCompleted(success: false) } performAPICall { result in task.setTaskCompleted(success: result != nil) } } // Perform API call (placeholder implementation) func performAPICall(completion: @escaping (Data?) -> Void) { // Your API call implementation here // For testing, you can use a simple delay: DispatchQueue.main.asyncAfter(deadline: .now() + 2) { completion(Data()) } } } extension AppDelegate: MessagingDelegate { func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String?) { print("FCM token: \(fcmToken ?? "nil")") // TODO: Send this token to your server } } Additionally, here is how we're sending notifications from the server side using Node.js: // Import the required Firebase Admin SDK (assumed to be initialized elsewhere) // const { getMessaging } = require('firebase-admin/messaging'); /** * Sends a background push notification to an iOS device * @returns {Promise<string>} The message ID if successful * @throws Will throw an error if the sending process fails */ async function sendBackgroundPushNotification() { // Construct the message object for a background push notification const message = { apns: { headers: { // Set the priority of the push notification "apns-priority": "5", priority: "5", // Indicate that this is a background refresh notification "content-available": "1", content_available: "1", // Specify the push type as background "apns-push-type": "background", // Set the topic to your app's bundle identifier "apns-topic": "com.your-company.your-app", // Replace with your actual bundle identifier }, payload: { aps: { // This tells iOS to wake up your app in the background "content-available": 1, }, }, }, // Custom data payload to be sent with the notification // Modify this object to include the data you want to send data: { // Add your custom key-value pairs here }, // Uncomment the following block if you want to include a visible notification // notification: { // title: "Notification Title", // body: "Notification Body", // }, token token: "DEVICE_FCM_TOKEN_PLACEHOLDER", }; try { // Attempt to send the message using Firebase Cloud Messaging const response = await getMessaging().send(message); console.log("Successfully sent background data to iOS:", response); return response; } catch (error) { console.error("Error sending background data to iOS:", error); throw error; } } // Example usage: // sendBackgroundPushNotification() // .then((response) => console.log("Message sent successfully:", response)) // .catch((error) => console.error("Failed to send message:", error)); We would really appreciate any insights or guidance on these issues. Thank you!
5
0
683
Aug ’24
Issues with Family Activity Selection in Screen Time API for Flutter Parental Control App
I am developing a parental control app using Flutter and platform channels to integrate with the Screen Time API on iOS. The app has two interfaces - one for the parent and one for the child. I have set up Family Sharing correctly and installed the app on both the parent's and child's devices. However, I am encountering some issues with the Family Activity Selection feature. It's worth noting that I am a Flutter developer with limited knowledge of Swift and iOS development, so if my issues stem from a mistake I made, please forgive me. The problems I am facing are as follows: When calling the family activity selection, the list of apps shown in the apps sheet is from the parent's device, and no apps from the child's device are displayed. I have double-checked that Family Sharing and other necessary configurations are set up correctly, including the family control capability. Even if I select apps on the parent's device, the selected apps are not returned in the result. The returned array is empty. Additionally, there is no close or done button on the sheet, and drag-to-dismiss is not working either. This might be an issue with the way I have written the code (most of the native code was generated by AI assistants like Claude and GPT, as I am a Flutter developer with limited knowledge of Swift and iOS development). I have tested other parental control apps that use the Screen Time API and observed the same issue, where the parent's apps are shown on the parent's device instead of the child's apps. For more context, I have provided the relevant code snippet below: import Flutter import FamilyControls import ManagedSettings import SwiftUI class FamilyActivityHandler: NSObject, FlutterPlugin { // ... private func openFamilyActivityPicker(result: @escaping FlutterResult) { let store = ManagedSettingsStore() let selection = FamilyActivitySelection() // Adjusting for UIWindowScene for iOS 15 and later guard let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene, let window = windowScene.windows.first else { result(FlutterError(code: "NO_WINDOW_SCENE", message: "No window scene found", details: nil)) return } let viewController = UIHostingController(rootView: FamilyActivityPicker(selection: .constant(selection))) viewController.modalPresentationStyle = .formSheet window.rootViewController?.present(viewController, animated: true, completion: nil) DispatchQueue.main.async { let applications = selection.applicationTokens let categories = selection.categoryTokens let webDomains = selection.webDomainTokens store.shield.applications = applications.isEmpty ? nil : applications store.shield.applicationCategories = ShieldSettings.ActivityCategoryPolicy.specific(categories, except: Set()) store.shield.webDomains = webDomains // Custom method to generate descriptive strings for tokens let applicationsDescription = applications.map { token in // Implement a custom description method or use an identifier property "\(token)" } let categoriesDescription = categories.map { token in // Implement a custom description method or use an identifier property "\(token)" } let webDomainsDescription = webDomains.map { token in // Implement a custom description method or use an identifier property "\(token)" } let resultDict: [String: Any] = [ "applications": applicationsDescription, "categories": categoriesDescription, "webDomains": webDomainsDescription ] result(resultDict) } } } I would greatly appreciate any guidance or insights from the community on how to resolve these issues and properly implement the Family Activity Selection feature using the Screen Time API in a Flutter app with platform channels. Thank you in advance for your help!
1
0
735
Apr ’24
Issues with Family Activity Selection in Screen Time API for Flutter Parental Control App
I am developing a parental control app using Flutter and platform channels to integrate with the Screen Time API on iOS. The app has two interfaces - one for the parent and one for the child. I have set up Family Sharing correctly and installed the app on both the parent's and child's devices. However, I am encountering some issues with the Family Activity Selection feature. It's worth noting that I am a Flutter developer with limited knowledge of Swift and iOS development, so if my issues stem from a mistake I made, please forgive me. The problems I am facing are as follows: When calling the family activity selection, the list of apps shown in the apps sheet is from the parent's device, and no apps from the child's device are displayed. I have double-checked that Family Sharing and other necessary configurations are set up correctly, including the family control capability. Even if I select apps on the parent's device, the selected apps are not returned in the result. The returned array is empty. Additionally, there is no close or done button on the sheet, and drag-to-dismiss is not working either. This might be an issue with the way I have written the code (most of the native code was generated by AI assistants like Claude and GPT, as I am a Flutter developer with limited knowledge of Swift and iOS development). I have tested other parental control apps that use the Screen Time API and observed the same issue, where the parent's apps are shown on the parent's device instead of the child's apps. For more context, I have provided the relevant code snippet below: import Flutter import FamilyControls import ManagedSettings import SwiftUI class FamilyActivityHandler: NSObject, FlutterPlugin { // ... private func openFamilyActivityPicker(result: @escaping FlutterResult) { let store = ManagedSettingsStore() let selection = FamilyActivitySelection() // Adjusting for UIWindowScene for iOS 15 and later guard let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene, let window = windowScene.windows.first else { result(FlutterError(code: "NO_WINDOW_SCENE", message: "No window scene found", details: nil)) return } let viewController = UIHostingController(rootView: FamilyActivityPicker(selection: .constant(selection))) viewController.modalPresentationStyle = .formSheet window.rootViewController?.present(viewController, animated: true, completion: nil) DispatchQueue.main.async { let applications = selection.applicationTokens let categories = selection.categoryTokens let webDomains = selection.webDomainTokens store.shield.applications = applications.isEmpty ? nil : applications store.shield.applicationCategories = ShieldSettings.ActivityCategoryPolicy.specific(categories, except: Set()) store.shield.webDomains = webDomains // Custom method to generate descriptive strings for tokens let applicationsDescription = applications.map { token in // Implement a custom description method or use an identifier property "\(token)" } let categoriesDescription = categories.map { token in // Implement a custom description method or use an identifier property "\(token)" } let webDomainsDescription = webDomains.map { token in // Implement a custom description method or use an identifier property "\(token)" } let resultDict: [String: Any] = [ "applications": applicationsDescription, "categories": categoriesDescription, "webDomains": webDomainsDescription ] result(resultDict) } } } I would greatly appreciate any guidance or insights from the community on how to resolve these issues and properly implement the Family Activity Selection feature using the Screen Time API in a Flutter app with platform channels. Thank you in advance for your help!
0
0
458
Apr ’24