Post

Replies

Boosts

Views

Activity

Reply to Running HealthKit query inside BGTaskScheduler closure
Here is my class for reference final class BackgroundTaskManager: NSObject { private var cancellables = Set<AnyCancellable>() func registerTasks() { BGTaskScheduler.shared.register(forTaskWithIdentifier: BackgroundTaskManager.processingIdentifier, using: nil) { [manager = self] task in manager.handle(task: task) } } func cancelAllTasks() { BGTaskScheduler.shared.cancelAllTaskRequests() } func scheduleTasks() { scheduleProcessingTask() } private func scheduleProcessingTask() { let request = BGProcessingTaskRequest(identifier: BackgroundTaskManager.processingIdentifier) request.earliestBeginDate = Date(timeIntervalSinceNow: 15 * 60) request.requiresNetworkConnectivity = true do { try BGTaskScheduler.shared.submit(request) } catch { print(error.localizedDescription) } } } extension BackgroundTaskManager { private static let processingIdentifier = "SOMEIDENTIFIER" } extension BackgroundTaskManager { public static let shared = BackgroundTaskManager() } extension BackgroundTaskManager { func handle(task: BGTask) { let provider = HealthDataProvider() let steps = Future { promise in provider.getTodaysSteps { result in promise(result) } } let distance = Future { promise in provider.getDistance { result in promise(result) } } Publishers.Zip(steps, distance) .flatMap { steps, distance -> AnyPublisher<HealthPostRequest.Parser.OutputType, Error> in let date = Date() let healthPostRequest = HealthPostRequest(steps: steps, distance: distance, date: date) return API.shared.postHealth(healthPostRequest: healthPostRequest) .eraseToAnyPublisher() } .sink() .store(in: &cancellables) } }
Topic: App & System Services SubTopic: Core OS Tags:
Jul ’21
Reply to VoiceOver spells word letter by letter
The workaround we have is by using umlauts: "TÄB". Ironically that's a very German solution to a problem.
Replies
Boosts
Views
Activity
Jan ’25
Reply to VoiceOver spells word letter by letter
@MobileTen thank you for your help, unfortunately neither breaking up nor hyphenating the word to "simply go tab", "simply-go tab" or "simply-go-tab" does help, "tab" is still spoken "T A B"
Replies
Boosts
Views
Activity
May ’24
Reply to Build Export differences between Xcode 15.2 and 15.3
Seems like issues are resolved with Xcode 15.4
Replies
Boosts
Views
Activity
May ’24
Reply to Running HealthKit query inside BGTaskScheduler closure
Here is my class for reference final class BackgroundTaskManager: NSObject { private var cancellables = Set<AnyCancellable>() func registerTasks() { BGTaskScheduler.shared.register(forTaskWithIdentifier: BackgroundTaskManager.processingIdentifier, using: nil) { [manager = self] task in manager.handle(task: task) } } func cancelAllTasks() { BGTaskScheduler.shared.cancelAllTaskRequests() } func scheduleTasks() { scheduleProcessingTask() } private func scheduleProcessingTask() { let request = BGProcessingTaskRequest(identifier: BackgroundTaskManager.processingIdentifier) request.earliestBeginDate = Date(timeIntervalSinceNow: 15 * 60) request.requiresNetworkConnectivity = true do { try BGTaskScheduler.shared.submit(request) } catch { print(error.localizedDescription) } } } extension BackgroundTaskManager { private static let processingIdentifier = "SOMEIDENTIFIER" } extension BackgroundTaskManager { public static let shared = BackgroundTaskManager() } extension BackgroundTaskManager { func handle(task: BGTask) { let provider = HealthDataProvider() let steps = Future { promise in provider.getTodaysSteps { result in promise(result) } } let distance = Future { promise in provider.getDistance { result in promise(result) } } Publishers.Zip(steps, distance) .flatMap { steps, distance -> AnyPublisher<HealthPostRequest.Parser.OutputType, Error> in let date = Date() let healthPostRequest = HealthPostRequest(steps: steps, distance: distance, date: date) return API.shared.postHealth(healthPostRequest: healthPostRequest) .eraseToAnyPublisher() } .sink() .store(in: &cancellables) } }
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Jul ’21
Reply to ASAuthorizationController delegate inside class not called
Nevermind, it was a weak referencing issue.
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Jun ’21