Delve into the world of built-in app and system services available to developers. Discuss leveraging these services to enhance your app's functionality and user experience.

Post

Replies

Boosts

Views

Activity

Difficulty blocking and scheduling with the Screen Time API
Hello, I'm currently facing some technical difficulties in implementing features related to application restrictions using the ScreenTime API. In our app, we allow users to set up restrictions for specific apps and app categories, with scheduled times and days (for example, Mondays and Thursdays, from 2pm to 5pm). The blocking sessions must run independently and simultaneously, allowing different sets of applications to be restricted at different times. However, I ran into two main problems: 1. Applying restrictions in the DeviceActivityMonitor extension: Although I can enable and disable restrictions, I haven't found an effective way to apply multiple FamilyActivitySelections directly in the DeviceActivityMonitor extension. The extension has to manage different blocking sessions independently, restricting different sets of applications and categories simultaneously or separately. I would like to know if it is possible to transmit this list of selected applications via UserDefaults or CoreData to the extension in order to facilitate this integra To better illustrate, here is a snippet of the code I am using: import Foundation import FamilyControls import ManagedSettings import DeviceActivity class AppBlockManager: ObservableObject { private let store = ManagedSettingsStore() private let center = DeviceActivityCenter() @Published var activitySelection: FamilyActivitySelection private var activityName: DeviceActivityName private var schedule: DeviceActivitySchedule init(selection: FamilyActivitySelection, activityName: DeviceActivityName, schedule: DeviceActivitySchedule) { self.activitySelection = selection self.activityName = activityName self.schedule = schedule } func startBlock() { do { try center.startMonitoring(activityName, during: schedule) if let applications = activitySelection.applications.isEmpty ? nil : activitySelection.applicationTokens { store.shield.applications = applications } if let categories = activitySelection.categories.isEmpty ? nil : activitySelection.categoryTokens { store.shield.applicationCategories = ShieldSettings .ActivityCategoryPolicy .specific(categories) store.shield.webDomainCategories = ShieldSettings .ActivityCategoryPolicy .specific(categories) } if let webDomains = activitySelection.webDomains.isEmpty ? nil : activitySelection.webDomainTokens { store.shield.webDomains = webDomains } } catch { print("Error starting monitoring: \(error)") } } func stopBlock() { store.shield.applications = nil store.shield.webDomains = nil store.shield.applicationCategories = nil store.shield.webDomainCategories = nil center.stopMonitoring([activityName]) } } Currently, this AppBlockManager is part of the main app target, not within the DeviceActivityMonitor extension, which is currently empty. With this configuration, I can only have one blocking session active at a time, and when it is deactivated, all restrictions are removed. I tried using different ManagedSettingsStore instances, each named individually, but without success. 2. Problems with scheduling restrictions: Currently, when setting up scheduled monitoring via DeviceActivitySchedule, the restrictions are activated immediately, ignoring the specific times scheduled (e.g. starting at 2pm and ending at 5pm). I need the schedule to work correctly, applying the restrictions only during the defined periods. Alternatively, I've considered running a background task that checks whether active sessions (up to a maximum of 3) should apply the restrictions at that time, but I'm still looking for a more suitable solution. In view of these challenges, I would like some guidance on the following points: What would be the best way to configure the DeviceActivityMonitor extension to receive and apply different FamilyActivitySelections, ensuring that the blocking sessions are independent and can run simultaneously? Is there a recommended approach to ensure that restrictions scheduled via DeviceActivitySchedule are applied and removed according to the times and days defined by the user, ensuring that applications are restricted only during the scheduled periods?
0
1
233
Oct ’24
WeatherKit moonPhase:full is skipped
HI there, when requesting the daily forecast via the WeatherKit REST API, I found out that under certain circumstances the moon phase full is skipped. Example from Japan (working): { "forecastDaily": { "name": "DailyForecast", "metadata": { "attributionURL": "https://developer.apple.com/weatherkit/data-source-attribution/", "expireTime": "2024-10-21T15:16:10Z", "latitude": 35.650, "longitude": 139.840, "readTime": "2024-10-21T14:16:10Z", "reportedTime": "2024-10-21T12:00:37Z", "units": "m", "version": 1, "sourceType": "modeled" }, "days": [ ..., { "forecastStart": "2024-10-16T15:00:00Z", "forecastEnd": "2024-10-17T15:00:00Z", "conditionCode": "MostlyCloudy", "maxUvIndex": 4, "moonPhase": "waxingGibbous", "moonrise": "2024-10-17T07:47:26Z", "moonset": "2024-10-16T20:09:01Z", "precipitationAmount": 0.09, "precipitationChance": 0.43, "precipitationType": "rain", ... "windSpeedMax": 16.03, }, { "forecastStart": "2024-10-17T15:00:00Z", "forecastEnd": "2024-10-18T15:00:00Z", "conditionCode": "Rain", "maxUvIndex": 4, "moonPhase": "full", "moonrise": "2024-10-18T08:20:34Z", "moonset": "2024-10-17T21:24:49Z", "precipitationAmount": 4.83, "precipitationChance": 0.83, "precipitationType": "rain", ... "windSpeedMax": 15.57, }, { "forecastStart": "2024-10-18T15:00:00Z", "forecastEnd": "2024-10-19T15:00:00Z", "conditionCode": "Drizzle", "maxUvIndex": 5, "moonPhase": "waningGibbous", "moonrise": "2024-10-19T08:58:43Z", "moonset": "2024-10-18T22:42:03Z", "precipitationAmount": 3.85, "precipitationChance": 0.76, ... "windSpeedMax": 28.81, }, ... ] } } Example from Germany where the fullmoon is skipped: { "forecastDaily": { "name": "DailyForecast", "metadata": { "attributionURL": "https://developer.apple.com/weatherkit/data-source-attribution/", "expireTime": "2024-10-21T15:41:17Z", "latitude": 47.760, "longitude": 12.650, "readTime": "2024-10-21T14:41:17Z", "reportedTime": "2024-10-21T13:00:37Z", "units": "m", "version": 1, "sourceType": "modeled" }, "days": [ { "forecastStart": "2024-10-16T22:00:00Z", "forecastEnd": "2024-10-17T22:00:00Z", "conditionCode": "MostlyClear", "maxUvIndex": 3, "moonPhase": "waxingGibbous", "moonrise": "2024-10-17T16:07:30Z", "moonset": "2024-10-17T05:19:30Z", "precipitationAmount": 0.0, ... "windSpeedMax": 8.23, }, { "forecastStart": "2024-10-17T22:00:00Z", "forecastEnd": "2024-10-18T22:00:00Z", "conditionCode": "Cloudy", "maxUvIndex": 2, "moonPhase": "waningGibbous", "moonrise": "2024-10-18T16:30:22Z", "moonset": "2024-10-18T06:48:39Z", "precipitationAmount": 1.17, ... "windSpeedMax": 8.73, }, { "forecastStart": "2024-10-18T22:00:00Z", "forecastEnd": "2024-10-19T22:00:00Z", "conditionCode": "Cloudy", "maxUvIndex": 2, "moonPhase": "waningGibbous", "moonrise": "2024-10-19T16:59:14Z", "moonset": "2024-10-19T08:18:33Z", "precipitationAmount": 0.02, ... "windSpeedMax": 7.16, }, ] } } As you can see here https://moon.nasa.gov/moon-observation/daily-moon-guide/?intent=011#1729171951907::0:: and on several other sites specialized on the lunar cycle) on 2024-10-17 should be shown full moon. I know this error is probably because the forecast starts prior to the full moon phase and ends after it but customers don't care about technicalities. They see that there is a full moon missing and complain to me. And they are right. Can you fix this somehow? For example, if a DailyForecast spans the majority of a full moon this Day is marked as full moon. Another question: Are you considering providing a moonPhase attribute to the "currentWeather" dataset? That would be the best option. (At least for me :))
1
2
155
Oct ’24
v2 Weatherkit REST API documentation release date
Hi. The WWDC video of the v2 weatherkit api showed some examples for the REST API. However, they were very limited. The documentation for the REST API is currently for the v1 weatherkit API. When will the documentation for the v2 API be released? There are some new features of the v2 that I would really like to use, but I can't without knowing the new v2 REST API specifications. Any guidance would be much appreciated. Thanks!
5
1
610
Jul ’24
Erreur 34 311
hi i dont know if i post in a good section. i have crash without message in console only error 34 311 what does this code mean? erreur -311 smFHBlkDispErr : an error occurred during _sDisposePtr (suppression du bloc FHeader). erreur -34 dskFulErr : full disk or is this something else? thank
2
0
222
Oct ’24
steam game crash. HELP
Process: ArmA3 [9180] Path: /Users/USER/Library/Application Support/Steam/*/ArmA3.app/Contents/MacOS/ArmA3 Identifier: com.vpltd.Arma3 Version: 1.82.0 (20230605.1) Code Type: X86-64 (Translated) Parent Process: launchd [1] User ID: 501 Date/Time: 2024-10-19 11:33:49.3660 +0100 OS Version: macOS 15.1 (24B5077a) Report Version: 12 Anonymous UUID: C2C26AB0-3885-5F5F-E3E0-4D98B373493E Sleep/Wake UUID: 8FDB755C-9D72-4485-BB5A-BD8593ADEF9F Time Awake Since Boot: 31000 seconds Time Since Wake: 8273 seconds System Integrity Protection: enabled Notes: PC register does not match crashing frame (0x0 vs 0x10011E9BB) Crashed Thread: 33 E.d3d11.BackendThread Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000018 Exception Codes: 0x0000000000000001, 0x0000000000000018 Termination Reason: Namespace SIGNAL, Code 11 Segmentation fault: 11 Terminating Process: exc handler [9180] VM Region Info: 0x18 is not in any region. Bytes before following region: 4294967272 REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL UNUSED SPACE AT START ---> __TEXT 100000000-101b74000 [ 27.5M] r-x/r-x SM=COW /Users/USER/Library/Application Support/Steam/*/ArmA3.app/Contents/MacOS/ArmA3 Error Formulating Crash Report: PC register does not match crashing frame (0x0 vs 0x10011E9BB) Thread 0:: E.runloop Dispatch queue: com.apple.main-thread 0 ??? 0x7ff895c16a84 ??? 1 libsystem_kernel.dylib 0x7ff8059d9e0e mach_msg2_trap + 10 2 libsystem_kernel.dylib 0x7ff8059e8622 mach_msg2_internal + 84 3 libsystem_kernel.dylib 0x7ff8059e0f16 mach_msg_overwrite + 649 4 libsystem_kernel.dylib 0x7ff8059da0ff mach_msg + 19 5 CoreFoundation 0x7ff805aff9dd __CFRunLoopServiceMachPort + 143 6 CoreFoundation 0x7ff805afe3ed __CFRunLoopRun + 1393 7 CoreFoundation 0x7ff805afd84c CFRunLoopRunSpecific + 550 8 HIToolbox 0x7ff811618ec3 RunCurrentEventLoopInMode + 292 9 HIToolbox 0x7ff81161e8a4 ReceiveNextEventCommon + 646 10 HIToolbox 0x7ff81161ea42 _BlockUntilNextEventMatchingListInModeWithFilter + 66 11 AppKit 0x7ff809381b6f _DPSNextEvent + 902 12 AppKit 0x7ff809db66b4 -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1290 13 gameoverlayrenderer.dylib 0x11a99b2fe 0x11a97c000 + 127742 14 ArmA3 0x100060dbd 0x100000000 + 396733 15 ArmA3 0x1002e8cb0 0x100000000 + 3050672 16 CoreFoundation 0x7ff805af4d5e CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER + 137 17 CoreFoundation 0x7ff805b81254 ___CFXRegistrationPost_block_invoke + 86 18 CoreFoundation 0x7ff805b811aa _CFXRegistrationPost + 528 19 CoreFoundation 0x7ff805ac4bde _CFXNotificationPost + 817 20 Foundation 0x7ff806a3c08b -[NSNotificationCenter postNotificationName:object:userInfo:] + 82 21 AppKit 0x7ff80938b59f -[NSApplication _postDidFinishNotification] + 311 22 AppKit 0x7ff80938b2e4 -[NSApplication _
1
0
168
Oct ’24
Are uninstall routines ever run for normal macOS app removal?
If you "uninstall" an app from your Mac using the standard "uninstall" methodologies, does macOS ever run an uninstaller in the background to clean up files and/or folders outside the app's .app folder? The standard "uninstall" methodologies that I know about are: trashing an application's .app folder, then emptying the trash long-clicking on an app in Launchpad, then clicking on its X while it jiggles Are there any other standard methodologies to "uninstall" a macOS app? Does any of the methodologies run any uninstall routine other than just deleting the .app folder from the file system (like maybe removing a folder under ~/Library/Caches)? Are there any problems with running rm -rf <path-to-.app-folder> instead of trashing the app folder/Lauchpad jiggling to death the app? Are there any differences between uninstall routines for apps installed from the Mac App Store versus apps installed by other means?
3
0
205
Oct ’24
Updating SKAdNetwork Certificates for AdAttributionKit Compatibility
We are trying to test AdAttributionKit integration and receive a postback in the testing environment with our existing SKAdNetwork identifier and SKAdNetwork certificates, that we had received after registering SKAdNetwork profile via an e-mail. The issue is that existing certificates were generated by Apple with prime192v1 algorithm, which is not supported by JWT, when we try to create token to sign AdAttribution impression. We have generated the updated private and public keys according to the documentation https://developer.apple.com/documentation/adattributionkit/registering-an-ad-network. Is it possible to update our existing SKAdNetwork certificates to the new AdAttributionKit certificates? Or do we need to do something else in order to make our SKAdNetwork certificates work with AdAttributionKit?
0
0
129
Oct ’24
"Unknown extension process" is displayed after app updating
Hello. In iOS 17, after updating the app, when trying to "Edit Widget" from a long press on the widget, "Unknown extension process" is displayed and the widget cannot be edited. At this time, the widget becomes completely white (or completely black), and it cannot be fixed without restarting the iPhone. This issue occurs sporadically on some devices. The implementation uses AppIntentTimelineProvider. Does anyone know a solution, workaround, or the cause of this problem? Thank you.
3
2
578
Jul ’24
Unable to call code inside App Intent Extension like updateAppShortcutParameters() - Linking error
Was watching this latest WWDC 2023 video and had a question. I see about 17:20 in, they mention you can now put the shortcut provider in an app intent extension. https://developer.apple.com/videos/play/wwdc2023/10103/ This works fine by itself and I can see all my shortcuts and use siri, but as soon as I try to call into the extension from the main app in order to trigger updateAppShortcutParameters() or any other code, I get a linker error. Am I doing something obvious wrong? Note, I called it a framework, but it Is just an extension. Cant figure out how I am supposed to be calling this method. Any help is greatly appreciated! https://developer.apple.com/documentation/appintents/appshortcutsprovider/updateappshortcutparameters()?changes=_4_8 https://imgur.com/a/yDygSVJ
1
0
701
Sep ’23
FinderSync Extension UI disappear on macOS 15's Setting
Description We used to use FIFinderSyncController.showExtensionManagementInterface() to navigate to the corresponding Setting's path via a button in our app to make the user enable our FinderSync App. (Or user can navigate manually via "System Settings -> Privacy & Security -> Extensions -> Added Extensions" themselves in Settings.app) But the UI is now disappearing on macOS 15.0 As a result, if user had previously enabled it, user will now be unable to disable it, and if user had not previously enabled it, user will never be able to enable it. STEPS TO REPRODUCE Create an empty macOS app xcodeprojc, add Finder Sync Extension and run it. Or you can use the repo here to reproduce the issue. https://github.com/Kyle-Ye/MenuHelper
2
2
304
Sep ’24
After updating iOS 18 CXCall is giving wrong values in hasConnected and hasEnded when user reject the call
Dear Apple team, I would like to report a problem that started after update my iPhone to iOS 18.0.1. When user receives a call and reject, CXCall is giving wrong values compared the previous version of iOS (minor of 18). In iOS 17.7, we received this values: hasConnected = false hasEnded = true iOS 18.0.1 we received 2 CXCall events: first event hasConnected = true hasEnded = false second event hasConnected = true hasEnded = true This behaviour is strange and not intuitive, and if we check the documentation, don`t make sense: A call is considered connected when both caller and callee can start communicating and A call is considered ended when the user disconnects or all other callers disconnect. Our code is very simple and use callObserver function to make the flow: public func callObserver(_ callObserver: CXCallObserver, callChanged call: CXCall) { if call.hasConnected, !call.hasEnded { //GoToViewControllerX } if call.hasEnded { //DoSomething } } With the behavior of iOS 18 the project will enter in first conditional and then will enter in second conditional. I need some help or some instruction because the intention ir only enter in first conditional if the call really happens.
2
3
241
Oct ’24
AdAttributionKit Development Testing problem
Hello. I would like to ask for an assistance with testing AdAttributionKit flow that seems not working. Goal: to close the AdAttributionKit logic flow loop starting from presenting and handling Ad in a publisher app and ending with receiving a postback request on my end point. Problem: No postback request is received on my configured domain. It looks like AdAttributionKit cannot connect between AppImpression invocation in Publisher App and updating postback from the Advertised App, hence no update postback request are transmitted to my endpoint. What was done: Testing device iPhone 13, iOS 18.0.1 Production Apple ID AdAttributionKit Developer Mode is enabled iPhone is reset and restarted Publisher App Test publisher application was created and configured (according to Apple's documentation [https://developer.apple.com/documentation/adattributionkit/configuring-a-publisher-app]) with the following: AdNetworkIdentifiers item was added to app's Info.plist with number of Ad Network IDs. I tried to use in my tests (used below insted of the placeholder): Registered SKAdNetwork Ad Network ID that ends with .skadnetwork Not registered Ad Network ID that ends with .adattributionkit JWS Impression was created with the following JWS Header: {"kid" : "","alg" : "ES256"} JWS Payload: {"impression-type" : "app-impression","impression-identifier" : "9547875E-C052-44CD-8CB9-193978CC5AB7", "timestamp" : 1729162517373,"publisher-item-identifier" : 0,"source-identifier" : 1111,"ad-network-identifier" : "","advertised-item-identifier" : 1125517808} JWS Data: "BASE64(JWS-Header)"."BASE64(JWS-Payload)"."SIGNED("BASE64(JWS-Header).BASE64(JWS-Payload)")" Signing was done with temporary key (created every time the JWS is composed) by the following: let signingInput = "\(headerBase64String).\(payloadBase64String)" let privateKey = Curve25519.Signing.PrivateKey() var encodedSignature = "" do { let signature = try privateKey.signature(for: Data(signingInput.utf8)) encodedSignature = base64UrlEncode(signature) } catch { print("Error signing JWS: \(error.localizedDescription)") } UIEventAttributionView (with UITapGestureRecognizer) was added to my ViewController's main view and in a handling method of TAP event, AppImpression was created baased on JWS above and handleTap() method of this AppImpression instance was called. AppImpression was tapped and AppStore has been launched (because to this moment no advertised app with was installed on a device): attributionkitd Preflighting impression AAKPubApp Connection established attributionkitd Validated impression for advertised app: <MY-ADVERTISED-APP-APPSTORE-ID-PLACEHOLDER> attributionkitd No distributor bundle ID received from app fetch attributionkitd Distributor metadata cached for item ID <MY-ADVERTISED-APP-APPSTORE-ID-PLACEHOLDER> attributionkitd Is anything happening? attributionkitd Processing tap attributionkitd Successfully validated publisher application attributionkitd Successfully finalized click through impression attributionkitd Impression is not eligible for re-engagement attributionkitd Launching distributor for itemID: <MY-ADVERTISED-APP-APPSTORE-ID-PLACEHOLDER> attributionkitd [0x70008b340] activating connection: mach=false listener=false peer=false name=(anonymous) attributionkitd Distributor launch completed for item ID: <MY-ADVERTISED-APP-APPSTORE-ID-PLACEHOLDER> Advertised App Advertised App is an existing application on the AppStore. It was configured according Apple's documentation [https://developer.apple.com/documentation/adattributionkit/configuring-an-advertised-app]. AttributionCopyEndpoint key with my domain ("https://<MY_DOMAIN_PLACEHOLDER>.com") was added to app's Info.plist EligibleForAdAttributionKitReengagementPostbackCopies key with "YES" value was added to Info.plist as well. Number of postback method calls were added to the application in different places including application:didFinishLaunchingWithOptions. Used AdAttributionKit method - (updateConversionValue(_:coarseConversionValue:lockPostback:)) [https://developer.apple.com/documentation/adattributionkit/postback/updateconversionvalue(_:coarseconversionvalue:lockpostback:)] Application is written in Objective-C while using AdAttributionKit via Swift-to-ObjC regular bridging. I tried to use Advertised App in the following ways: To run it from Xcode. This way, when the advertised app is already installed, AppImpression tap in the publisher App doesn't recognize the Advertised App is installed and launches AppStore. To install it from TestFlight. This way, AppImpression tap in the publisher App successfully recognizes the Advertised App is installed and launches it. Both ways yield the same result - explanation below. Advertised App launched - while calling update postback method in application:didFinishLaunchingWithOptions attributionkitd Updating postback attributionkitd Queueing update postback attributionkitd [TXNf0dc] 🐏 Beginning transaction (Task runner: atomic) attributionkitd Begin update postback <MY-APPLICATION-NAME-PLACEHOLDER> Connection established attributionkitd [TXN5421] 🐏 Ending transaction (<private>) (<private>) attributionkitd Retrieved conversion window thresholds: <private> attributionkitd [TXNf0dc] 🐏 Ending transaction (<private>) (<private>) ... attributionkitd Calling launch handler for com.apple.attributionkitd.development-postback-transmission attributionkitd Begin task for identifier: com.apple.attributionkitd.development-postback-transmission attributionkitd Running barktivity: com.apple.attributionkitd.development-postback-transmission attributionkitd [TXN46f0] 🐏 Beginning transaction (<private>) attributionkitd Found 0 postbacks eligible for transmission for environments: <private> attributionkitd Postback transmission completed attributionkitd [TXN46f0] 🐏 Ending transaction (<private>) (<private>) attributionkitd Marking task <BGRepeatingSystemTask: com.apple.attributionkitd.development-postback-transmission> complete attributionkitd Task completed for identifier: com.apple.attributionkitd.development-postback-transmission The problem I can see here is in the following line: attributionkitd Found 0 postbacks eligible for transmission for environments: <private> It looks like AdAttributionKit cannot connect between AppImpression invocation in Publisher App and updating postback from the Advertised App. Please correct me in case I'm doing anything wrong or missing anything. Thank you very much.
1
0
201
Oct ’24
Universal link failing to redirect to app in special circumstances
I'm developing two native apps and one is a authentication app and other one is business app. In the main flow if buisness application is on the foreground and did nothing for at least 10 minutes it will automatically time out and redirect to the autentication app for token refresh. In this flow universal link redirect to the authetication app without opening Safari. But if i execute the below flow buissness app redirect to the Safari. Buisness App In Foregorund → Displaying a OS screen while app is in Foreground(Like Push Notification Center) → On this satate leave device for 10 minutes → Buisness app will automatically timeout and rediret to Safari(In safari 「NoSuchKey The specified key does not exist.」message is displaying but authentication app Universal link Start button is showing) → After click the Universal Link start button in Safari Authentication App open. I use the below code to start the Universal Link: if let url = URL(string: path) { UIApplication.shared.open(url) } So i would like to know is there a special reason that when Displaying a OS screen while app is in Foreground(Like Push Notification Center) affect the normal flow of Universal redirection to another app?
0
0
199
Oct ’24