Questions tagged watchos

Explore the latest questions and answers asked by our top developers.

HealthKit query for swimming strokes / style per lap

I managed to query for swimming strokes but it’s just the cumulative sum. private func querySwimStrokeCount(for sample: HKSample) { let strokeCount = HKSampleType.quantityType(forIdentifier: HKQuantityTypeIdentifier.swimmingStrokeCount)! let sampleDate = HKQuery.predicateForSamples(withStart: sample.startDate, end: sample.endDate, options: []) let query = HKStatisticsQuery(quantityType: strokeCount, quantitySamplePredicate: sampleDate, options: .cumulativeSum) { (query, statisticsOrNil, errorOrNil) in guard let statistics = statisticsOrNil else { return […]

By Nico S
Published
Categorised as healthkit, ios, watchos Tagged , ,

Independent Watch App using the WatchConnectivity framework

Is it possible to use the WatchConnectivity framework when creating an independent watchOS app? The documentation https://developer.apple.com/documentation/watchkit/creating_independent_watchos_apps states, that “An independent app can use WatchConnectivity to transfer information from its iOS companion app when the iOS device is available…” But how do we send data between the iOS app and the watchOS app? The WCSession […]

By Renato Stauffer
Published
Categorised as ios, watchconnectivity, watchos

Keep WatchKit Extension code (git repo) separated from the existing iPhone code (repo)

I wanted to add a WatchKit Extension (with SwiftUI supported on iOS13+) to my existing app (target iOS12) while keeping both codebase separated (two repos). How can I separate the WatchKit Extension code from the Mobile One? Will my Watch App with SwiftUI only work for users with WatchOS 6 and iOS13 without affecting the […]

By Ouadie
Published
Categorised as ios, swiftui, watchos, watchos-6, xcode

How can I diagnose and resolve a crash on WCSession sendMessage(_:replyHandler:errorHandler:)?

I’m building a watchOS app that needs to periodically request information from a companion iPhone app to refresh a complication. To achieve this, I have a WKApplicationRefreshBackgroundTask that runs periodically. It uses sendMessage(_:replyHandler:errorHandler:) from WatchConnectivity to request the information from the iPhone app, process the reply, and update the complication. This works reliably for many […]

By gohnjanotis
Published
Categorised as ios, watchconnectivity, watchkit, watchos, wcsession

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq