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.

Posts under General subtopic

Post

Replies

Boosts

Views

Activity

Trackpad becomes non-clickable
Hello, I have a Macbook Pro, 13", 2020, M1 model. Sometimes when I use my macbook, the trackpad becomes non-clickable, the only solution seems to be to manually turn it off. It has happened multiple times the past couple months, which has drawn me to write this post. I don't see manually turning it off, as a viable way of getting around the issue, on the long run. Today I was writing an application, and it was one of those applications where you fill out a form online, and it was not saveable. My trackpad stopped working and I had to turn off my macbook and lost all progress. Does anyone have any tips, tricks or information on what is happening? Is this just something that happens with older models? What can I do?
1
0
190
Dec ’24
Refreshing widgets - policy and background tasks?
I have widgets providing their timeline using the .atEnd reload policy, i.e.: // AppIntentTimelineProvider: return Timeline(entries: entries, policy: .atEnd) // TimelineProvider let timeline = Timeline(entries: entries, policy: .atEnd) completion(timeline) I can't seem to find any information on what happens after the end of the timeline. So, let's say I've got two days worth of entries, the dev docs for the reload policy say, "A policy that specifies that WidgetKit requests a new timeline after the last date in a timeline passes." Great! But how does it request the new timeline? Does iOS launch my app in the background and simply re-run the timeline to generate another two days worth of entries? I doubt it. I figure I need to implement some sort of background task, and the dev docs say how to do it with an Operation, but then I read that this is an old way of doing it? I've found some info online saying to use something like this, so this is what I've implemented: let kBackgroundWidgetRefreshTask = "my.refresh.task.identifier" // This has been registered in the info.plist correctly class SchedulingService { static let shared = SchedulingService() func registerBackgroundTasks() { let isRegistered = BGTaskScheduler.shared.register(forTaskWithIdentifier: kBackgroundWidgetRefreshTask, using: nil) { task in print("Background task is executing: \(task.identifier)") // This does print "true" self.handleWidgetRefresh(task: task as! BGAppRefreshTask) } print("Is the background task registered? \(isRegistered)") } func scheduleWidgetRefresh() { let request = BGAppRefreshTaskRequest(identifier: kBackgroundWidgetRefreshTask) // Fetch no earlier than 1 hour from now - test, will be two days request.earliestBeginDate = Date(timeIntervalSinceNow: 60 * 60) do { try BGTaskScheduler.shared.submit(request) print("Scheduled widget refresh for one hour from now") } catch { print("Could not schedule widget refresh: \(error)") } } private func handleWidgetRefresh(task: BGAppRefreshTask) { // Schedule a new refresh task scheduleWidgetRefresh() // Start refresh of the widget data let refreshTask = Task { do { print("Going to refresh widgets") try await self.backgroundRefreshWidgets() task.setTaskCompleted(success: true) } catch { print("Could not refresh widgets: \(error)") task.setTaskCompleted(success: false) } } // Provide the background task with an expiration handler that cancels the operation task.expirationHandler = { refreshTask.cancel() } } func backgroundRefreshWidgets() async throws { print("backgroundRefreshWidgets() called") definitelyRefreshWidgets() } } As I've commented above, the line print("Background task is executing: \(task.identifier)") does print true so the task has been registered correctly. I've put the app into the background and left it for hours and nothing is printed to the console. I've implemented a logger that writes to a file in the app container, but that doesn't get anything either. So, is there something I'm misunderstanding? Should I change the reload policy to .after(date)? But what makes the timeline reload? As a second but linked issue, my widgets have countdown timers on them and the entire timeline shows that every entry is correct, but the widgets on the Home Screen simply fail to refresh correctly. For example, with timeline entries for every hour for the next two days from 6pm today (so, 7pm, 8pm...) every entry in the preview in Xcode shows the right countdown timer. However, if you put the widget on the Home Screen, after about five hours the timer shows 25:12:34 (for example). No entry in the timeline preview ever shows more than 24 hours because the entires are every hour, and the one that shows a timer starting at 23:00:00 should never get to 24:00:00 as the next entry would kick in from 0:00:00, so it should never show more than 23:59:59 on the timer. It's like the 23:00:00 timer is just left to run for hours instead of being replaced by the next entry. It's as though the widget isn't refreshing correctly and entries aren't loaded? Given this is the Simulator - and my development device - and both are set to Developer Mode so widget refresh budgets aren't an issue, why is this happening? How do you get widgets to refresh properly? The dev docs are not very helpful (neither is the Backyard Birds example Apple keep pushing). Thanks!
5
0
1.1k
Dec ’24
Building Issue
Hello, I am very new to programming with Xcode. I’ve been searching the forums and online but can’t seem to find an answer. My project is not displaying the triangle build button in the left corner, nor the status of the build. No issues with my code are apparent, yet it does not build and preview when I push build and clean in the product tab
1
0
258
Dec ’24
Is there any official resource that lists all paths/URLs for iOS settings across versions?
HI! I am interested in redirecting the user to some specific iOS settings but just discovered that the paths/URLs to the settings change sometimes across iOS versions. Is there any official Apple resource with a list of all the paths for the iOS settings? Or at least for the latest iOS version? I found some non-official resources without citing the source, but it would be great to have official documentation about this topic. Thank you very much in advance for taking your time to read this post! Best regards, Iván
1
1
624
Dec ’24
ios18.2 public beta - Wallpaper/AOD issue
Hi all. Since upgrading to a new iPhone 16 pro, running 18.2 public beta, I'm having issue with my wallpaper/Lock Screen. If AOD is turned OFF, my lock screen is almost too dim to read, and the chosen Lock Screen wallpaper has a blurred effect on it. if AOD is ON, the screen is still too dim to read, and the wallpaper is just a faint shade of the colour of the image chosen.
1
0
374
Dec ’24
Video Camera Issues
Has anyone experienced frozen images when having camera on video recording mode? For example i live in Los Angeles and sometimes I like to record the sunrise or sunset or while I’m crossing a bridge but my video camera kinda freezes and doesn’t record. I’ve already checked my memory and I have more than enough to not have issues maybe it’s a setting issue? if anyone has a solution or suggestions please let me know thank you.
1
0
163
Dec ’24
Invalid_request Error When Remapping User Identifiers After App Transfer
Hello, We recently transferred our iOS app from an individual developer account to a corporate account. By following this guide (link), we successfully obtained the transfer identifiers for all our current users and have stored the data fetched from Apple. Now that the transfer has been completed for about 10 hours, we're attempting to remap the old identifiers to the new ones using this guide (link). Unfortunately, all our requests are returning an 'invalid_request' error. I've noticed others have faced the same problem, but I haven't found a solution yet. Can anyone help me resolve this issue?
1
0
518
Dec ’24
revoke api is not working.
https://developer.apple.com/documentation/sign_in_with_apple/revoke_tokens/ As shown in the documentation, when I tested via curl, I received a response with status 200, but when I logged in to account.apple.com with the linked account, it shows that it is still connected. I would like to know if there is any additional way to verify that the revoke api is working properly.
1
0
459
Dec ’24
Messages Pulling Incorrect Preview Image
We recently began getting reports that when posts are shared via Messages the rich preview will display an unrelated image from an altogether different post. The correct open graph image appears when sharing via every other platform we've tried (Slack, Whatsapp, Twitter/X) and the og:image tag refers to the appropriate image url. The image Messages uses in the rich preview only appears in an unrelated metadata tag that includes data for multiple recent posts. Has anyone else encountered this?
2
0
614
Dec ’24
Can I Detect Which App the User Opens Using the Screen Time API?
I'm working with the Screen Time API in iOS and have successfully implemented the following: Granted Screen Time Permission: The app asks for and obtains Screen Time permissions without any issues. Blocked Specific Apps: Using FamilyActivitySelection, I can block access to certain apps. Monitoring Device Activity: With DeviceActivityCenter().startMonitoring(), I’m able to successfully start monitoring. DeviceActivityCenter().startMonitoring(.myActivity, during: schedule) Now, I’m wondering if there’s a way to detect exactly which app the user opens, so I can fire an API from my own app based on that event. Is this kind of real-time app usage detection possible with the Screen Time API? If so, how might it be implemented?
2
1
496
Dec ’24
How to Filter App Usage for a Specific Time Period Using Screen Time API?
I am working on a SwiftUI app using the Screen Time API and the DeviceActivityReport view to display app usage data. My current implementation successfully shows daily app usage using a DeviceActivityFilter with the .daily(during:) segment. However, I need to filter this data to show app usage only for a specific time period during the day, e.g., 4:00 PM to 5:00 PM. I created a DeviceActivityFilter with a .daily(during:) segment and passed a DateInterval for the desired time range: let now = Date() let startTime = calendar.date(bySettingHour: 16, minute: 0, second: 0, of: now)! let endTime = calendar.date(bySettingHour: 17, minute: 0, second: 0, of: now)! let timeInterval = DateInterval(start: startTime, end: endTime) let filter = DeviceActivityFilter( segment: .daily(during: timeInterval), users: .all, devices: .init([.iPhone]) ) I applied this filter to the DeviceActivityReport view: DeviceActivityReport(context, filter: filter) Even with the DateInterval set for the specific time range, the report still shows the total daily usage for each app, instead of restricting the results to the specified 1:00 PM to 5:00 PM range.
0
1
410
Dec ’24
How can I access audio attachment from INSendMessageIntent
I'm trying to add Siri support to my app for sending voice messages. I've implemented INSendMessageIntentHandling in my main app target. It looks like it's getting as far as recording the voice message and passing my intent handler an INSendMessageIntent with an audio attachment, but I'm not able to read the attachment file. func handle( intent: INSendMessageIntent, completion: @escaping (INSendMessageIntentResponse) -> Void ) { if let attachment = intent.attachments?.first, let audioFile = attachment.audioMessageFile, let fileURL = audioFile.fileURL { // This branch runs // fileURL is "file:///var/mobile/tmp/SiriMessages/89F738F7-6092-439A-B4FA-2DD9A99F0EED.caf" let result = processMessageAudio(url: fileURL) completion(result) return } // This line isn't reached completion(.init(code: .failure, userActivity: nil)) } private func processMessageAudio(url: URL) -> INSendMessageIntentResponse { var fileRef: ExtAudioFileRef? if url.startAccessingSecurityScopedResource() { logDebug("File access allowed") } else { // This branch runs logDebug("File access not allowed") } defer { url.stopAccessingSecurityScopedResource() } let openStatus = ExtAudioFileOpenURL(url as CFURL, &fileRef) // openStatus is -54 (kAudio_FilePermissionError) return INSendMessageIntentResponse(code: .failure, userActivity: nil) } I'm not sure what I'm missing. It looks like there should be an audio file, and Siri shows a preview of the audio for confirmation.
4
0
648
Dec ’24
Feedback Assistant nonresponse
Hi All, Had a question. Is there a point to submit anything through the feedback assistant (https://feedbackassistant.apple.com)? I mean it doesn't seem like any engagement occurs through the platform on any issues submitted.
2
0
254
Dec ’24
Sequoia - Messages not receiving after 7+ hrs of uptime
Issue: Using Messages in macOS Sequoia, I stop receiving any messages after 7+ hrs of the system being on. Troubleshooting: any messages sent to the target account doesn't show up when this issue occurs. I'm able to send messages from the target account which is received. only way to get it working is to reboot the computer but those messages sent never arrive to the target account even after reboot. upon reboot the behavior functions as expected. however the issue returns after 7hrs+ after reboot. logout and log back in when the system is in this state doesn't resolve the issue. only a reboot but the issues eventually returns. note the 7hrs+ is tested and is more accurately 7-10 hrs.
1
0
385
Dec ’24
Pre-LoginWindow Agent and macOS Sequoia
I previously had an application running at the login window prior to macOS Sequoia. It's a simple program specific to the needs of my company that did it's job. As you've probably guessed, with the move to Sequoia, it no longer works. Having developed this application, I'm fairly familiar with how all this works, so...is there something that changed with the loginwindow context in macOS Sequoia that affected this (and I obviously missed)? I've gone through DTS tickets previously and will again if necessary, but I'm hoping someone can just point out a linker option or build setting that is new with Sequoia. Thanks!
2
0
267
Dec ’24