watchOS is the operating system for Apple Watch.

Posts under watchOS tag

200 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

SimpleWatchConnectivity sample - TransferFile fails
When launching the SimpleWatchConnectivity sample in a simulator (iOS 18.2 + watchOS 11.2), almost all the functionality works, but TransferFile does not work. The error is the following: -[WCFileStorage persistOutgoingFileTransfer:] error serializing file transfer <WCSessionFileTransfer: ...> due to Error Domain=NSCocoaErrorDomain Code=4866 "Caught exception during archival: This object may only be encoded by an NSXPCCoder." How can it be fixed or worked around?
1
0
70
4d
Is is possible to have environment variables in iOS, watchOS and tvOS? How does it work?
Hi, so a little context, by environment variables I mean like $HOME in linux. I know that there are some standard and some app specific environment variables in the above mentioned platforms. Is is possible for the user to set environment variables? If so, what are the ways in which users can set environment variables in the platforms mentioned across the system or for the app as they would in macOS/linux/windows? And is it possible for developers of the app do the same? If so how? What I have found so far is that it cannot be done by users, and there is one place in xcode where I, as a developer can set environment variables for my app from the scheme. This isn't available when I ship just the installation binary to the end user, but rather is available only when the app is run using xcode. I just need validation that what I understand is correct and that there aren't other ways to do this by the user/developer without jailbreaking.
1
0
123
1w
Watch OS - Complications settings not showing anywhere.
I have a fully functioning IOS / Watch App working on hardware and software test. But, I cannot figure out how to get complications to show up: Xcode itself does not show complication choices in the target settings. Can't find a clear simple explanation of the various choices in the settings. Complication choices in the IOS iPhone app settings never appear Not at all sure how complications get assigned to 'groups' etc. ...been a roadblock for weeks...very confusing area. Not new to Xcode ( 10+ years experience). But the basic certificate, settings, info list combination seems always to be a massive hurdle to navigate.
1
0
139
2w
Intents not showing up in WatchOS Shortcuts
I have developed a standalone WatchOS app which runs a stopwatch. I want to develop a shortcut that launches the stopwatch. So far I have created the Intent file, and added the basic code (shown below) but the intent doesn't show in the shortcuts app. In the build, I can see the intent metadata is extracted, so it can see it, but for some reason it doesn't show in the watch. I downloaded Apple's demo Intent app and the intents show in the watch there. The only obvious difference is that the Apple app is developed as an iOS app with a WatchOS companion, whereas mine is standalone. Can anyone point me to where I should look for an indicator of the problem? Many thanks! // // StartStopwatch.swift // LapStopWatchMaster import AppIntents import Foundation struct StartStopWatchAppIntent: AppIntent { static let title: LocalizedStringResource = "Start Stopwatch" static let description = IntentDescription("Starts the stopwatch and subsequently triggers a lap.") static let openAppWhenRun: Bool = true @MainActor func perform() async throws -> some IntentResult { // Implement your app logic here return .result(value: "Started stopwatch.") } }
3
0
159
2w
watchOS app crashing on devices running watchOS 11+
We have a watchOS app in TestFlight that is currently crashing on any device running watchOS 11 and up. I have an older Apple Watch SE that's capped at 10.6.1 that can run the app just fine, but the same exact install on a newer device fails. This started happening after I updated my MacBook to macOS Sequoia and Xcode to 16. In order to get the Watch app to run on the 10.6.1 device, I had to change the Swift Optimization Level from -O to -Osize. I already filed Feedback on this (FB15691116). I've tried so many different things and have come up with nothing to show for it. When I look in the IPS file, I see that the crash point in my code on the watchOS 11 device is at KinesiaUOnWatch`@objc SessionDelegator.session(_:activationDidCompleteWith:error:): 0x3a3f48 <+0>: sub sp, sp, #0x60 0x3a3f4c <+4>: stp x26, x25, [sp, #0x10] 0x3a3f50 <+8>: stp x24, x23, [sp, #0x20] 0x3a3f54 <+12>: stp x22, x21, [sp, #0x30] 0x3a3f58 <+16>: stp x20, x19, [sp, #0x40] 0x3a3f5c <+20>: stp x29, x30, [sp, #0x50] 0x3a3f60 <+24>: add x29, sp, #0x50 0x3a3f64 <+28>: mov x19, x4 0x3a3f68 <+32>: mov x23, x2 0x3a3f6c <+36>: mov x22, x0 0x3a3f70 <+40>: mov w0, #0x0 ; =0 0x3a3f74 <+44>: bl 0x89818 ; symbol stub for: type metadata accessor for Swift.MainActor 0x3a3f78 <+48>: mov x24, x0 0x3a3f7c <+52>: adrp x25, 161 0x3a3f80 <+56>: ldr w25, [x25, #0x654] 0x3a3f84 <+60>: mov x20, x0 0x3a3f88 <+64>: bl 0x8980c ; symbol stub for: static Swift.MainActor.shared.getter : Swift.MainActor 0x3a3f8c <+68>: mov x21, x0 0x3a3f90 <+72>: adrp x0, 166 0x3a3f94 <+76>: add x0, x0, #0xc40 ; lazy protocol witness table cache variable for type Swift.MainActor and conformance Swift.MainActor : Swift.Actor in Swift Incident Identifier: 08E2F667-7965-4C86-B85E-9E2F03EAA963 Beta Identifier: AD390666-55CB-43B3-9B14-BD3E70F456EB Hardware Model: Watch6,1 Process: KinesiaUOnWatch [389] Path: /private/var/containers/Bundle/Application/B571E983-F2B0-40EF-9F0D-8C471CAEB3FB/KinesiaUOnWatch.app/KinesiaUOnWatch Identifier: com.glneurotech.kinesiau.watchapp Version: 5.1.0 (510271) AppStoreTools: 16B39 AppVariant: 1:Watch6,1:11 Beta: YES Code Type: ARM64_32 (Native) Role: Foreground Parent Process: launchd [1] Coalition: com.glneurotech.kinesiau.watchapp [464] Date/Time: 2024-12-03 15:12:51.1876 -0500 Launch Time: 2024-12-03 15:12:50.0000 -0500 OS Version: Watch OS 11.1 (22R585) Release Type: User Report Version: 104 Exception Type: EXC_BREAKPOINT (SIGTRAP) Exception Codes: 0x0000000000000001, 0x000000002053dd4c Termination Reason: SIGNAL 5 Trace/BPT trap: 5 Terminating Process: exc handler [389] But, as I said, this exact app runs just fine on an older watchOS 10.6.1 device. Has anyone else encountered something like this, or have any ideas on stuff to try?
1
0
150
3d
Why do we still have the 7 day limitation of HealthKit data on Apple Watch?
It may have made sense in the early days of watchOS, but given the Apple Watch is now 10 years old and we have "Standalone" Apple Watch apps, it no longer makes sense to have this seemingly arbitrary limitation of only being able to query 7 days of data on the watch. I have an open feedback (FB7649612) from 2020 with no responses and ask this question every year at WWDC Developer labs. WHY must we still deal with this limitation which only causes other developers to store critical health data in iCloud or on their own servers in order to provide a robust stand alone watch experience on the Apple Watch. Even Apple themselves must either use a separate private API or use iCloud for the new Vitals app. How else can I escalate this request?
1
1
190
2w
watchOS 4 in Xcode 16
I saw in the Xcode 16 release notes that on-device debugging is no longer available on watchOS prior to version 7.0, but I can't even get a signed, compiled app to run on an older watch. The current version I have live in the App Store works just fine on 4.3.2. I have changed no code, I just started building the app with Xcode 16, and now it won't launch on older watches. Is it no longer possible to update an app for older watches?
1
0
190
4d
XCode see's WatchOS 11.2 but can't connect
Attempting to write my first WatchOS App which builds correctly and refuses to run on my target physical watch. The code runs fine on the simulator. IOS 18.2, Watch OS 11.2, XCode 16.1 When I run, the pop-up shows: Connecting to Apple Watch (about 5 seconds) Apple Watch may need to be unlocked to recover from previously reported preparation errors (less than a second)(needed to screen record to catch the error) Waiting to reconnect to Apple Watch (lives here indefinitely) Both the Watch and iPhone were unlocked during the build/run sequence. The iPhone is in "Developer" Mode, but could not find the switch anywhere on the watch or watch app to enable dev mode.
1
0
234
3w
CMAltimeter not delivering relative altitude updates
I want to get the barometric pressure reading from the built-in barometer to display it in my iOS app. When I use CMAltimeter.startRelativeAltitudeUpdates(), my app receives no relative altitude update events, which means I can't view the barometric pressure from the sensor (because that's only contained in CMAltitudeData, not CMAbsoluteAltitudeData. If I use CMAltimeter.startAbsoluteAltitudeUpdates(), I get absolute altitude update events every second or so. NSMotionUsageDescription is set. I have tried the following things, all of which haven't worked: Only calling startRelativeAltitudeUpdates() and not startAbsoluteAltitudeUpdates() Calling CMSensorRecorder.recordAccelerometer(forDuration: 0.1), as suggested in this thread Calling CMMotionActivityManager.queryActivityStarting(from: .now, to: .now, to: .main), as suggested here Physically moving my iPhone up and down about 200 feet using an elevator; I see absolute altitude updates which are in line with what's expected, but still receive no relative altitude update events Calling the same APIs in a watchOS app on an Apple Watch Series 10; I see much less frequent absolute altitude updates, and still no relative altitude updates I know the barometer sensor is working, because when I move my iPhone up and down even a foot or two indoors, I see an immediate change in the absolute altitude reading that I know wouldn't come from GPS. This example code, when run on my iPhone 16 Pro running iOS 18.1.1, prints updates started and then updating absolute every second, but doesn't print anything else. The absolute altitude, accuracy, and authentication status fields update (and the auth status shows 3, indicating .authorized), but the relative altitude and pressure fields remain as --. struct ContentView: View { @State private var relAlt: String = "--" @State private var relPressure: String = "--" @State private var absAlt: String = "--" @State private var precision: String = "--" @State private var accuracy: String = "--" @State private var status: String = "--" var body: some View { VStack { Text("Altitude: \(relAlt) m") .font(.title3) Text("Pressure: \(relPressure) kPa") .font(.title3) Text("Altitude (absolute): \(absAlt) m") .font(.title3) Text("Precision: \(precision) m") .font(.title3) Text("Accuracy: \(accuracy) m") .font(.title3) Text("Auth status: \(status)") .font(.title3) } .padding() .onAppear { let altimeter = CMAltimeter() startRelativeBarometerUpdates(with: altimeter) startAbsoluteBarometerUpdates(with: altimeter) status = CMAltimeter.authorizationStatus().rawValue.formatted() print("updates started") } } private func startRelativeBarometerUpdates(with altimeter: CMAltimeter) { guard CMAltimeter.isRelativeAltitudeAvailable() else { relAlt = "nope" relPressure = "nope" return } altimeter.startRelativeAltitudeUpdates(to: .main) { data, error in if let error = error { print("Error: \(error.localizedDescription)") return } if let data = data { print("updating relative") relAlt = String(format: "%.2f", data.relativeAltitude.doubleValue) relPressure = String(format: "%.2f", data.pressure.doubleValue) } else { print("no data relative") } } } private func startAbsoluteBarometerUpdates(with altimeter: CMAltimeter) { guard CMAltimeter.isAbsoluteAltitudeAvailable() else { absAlt = "nope" print("no absolute available") return } let altimeter = CMAltimeter() altimeter.startAbsoluteAltitudeUpdates(to: .main) { data, error in if let error = error { print("Error: \(error.localizedDescription)") return } if let data = data { print("updating absolute") absAlt = String(format: "%.2f", data.altitude) precision = String(format: "%.2f", data.precision) accuracy = String(format: "%.2f", data.accuracy) } } } } Is this behavior expected? How can I trigger delivery of relative altitude updates to my app?
1
0
210
3w
How can I make an "inverted" list (bottom to top) with SwiftUI?
I'm trying to figure out how to make an inverted list in my watchOS app for a message view, so that messages appear from the bottom first, and go up. Everything I've tried so far has some sort of major drawback, and I'm wondering if there's some proper way to do it. My current implementation is flipping every message item upside-down, then flipping the whole list upside-down. This works in making the list go from bottom to top, but the digital crown scroll direction is also inverted. Simply inverting the array of messages doesn't work either, as the user has to scroll to the bottom of the list manually every time. Any tips/suggestions would be greatly appreciated.
0
0
178
3w
WCSessionUserInfoTransfer. isTransferring can not be updated when transfer was completed
Hi, I am new to swift and IOS development, I was developing an app which can be used to communicating between Apple Watch and iPhone. Something strange occurred when I was trying to observe the status of the message(UserInfo) sent by func transferUserInfo(_ userInfo: [String : Any] = [:]) -> WCSessionUserInfoTransfer. I was trying to observe isTransferring(a boolean value) in WCSessionUserInfoTransfer which was returned by the function mentioned above, but it seems cannot be updated even if the message queue was empty, it seems to always be True. Here is my sample code: let transfer = session.transferUserInfo(message) if transfer.isTransferring { Timer.scheduledTimer(withTimeInterval: 0.5, repeats: true) { timer in print("Queued message count: \(self.session.outstandingUserInfoTransfers.count), isTransferring:\(transfer.isTransferring)") if !transfer.isTransferring { timer.invalidate() // irrelevant codes... } } } else { // other irrelevant codes... } Appreciate if anyone can help me out of this problem. Best wishes.
0
0
206
3w
Apple Watch Modular Ultra issue for YEARS!
Hi. I’m not sure where to post it, but after 1.5 years with the AWU2 the main Watch face is still bugged, missing seconds (two digit) in format. In the attached example it shows “06:30:5” for 10 seconds until it hits ”06:31:00”. I’m not sure if it’s only related to Danish AWU’s. But it is so annoying, and has forced me to change watch to Garmin in the past. PLEASE FIX IT, please please.
1
0
138
5d
Is there a way to disable button tap feedback in watchOS double-tap gesture?
First post here! Is there a way to reduce the number of haptic feedback for double tap on primary button? Context: Double tap is awesome. Two haptic actuations are given to the gesture to let the user know that the gesture is "received" then a third haptic feedback is given shortly after to signal the primary button is tapped. Is there a way to disable the third haptic feedback. In other words make primary action "silent"? I have tested a number of apps that supports double tap, it seems to me that the triple tap is a system level default, and it cannot be changed. Any help would be greatly appreciated.
0
0
188
3w
HKWorkoutSession.sendToRemoteWorkoutSession doesn't report success or failure
We are seeing an issue where sending data using the asynchronous method HKWorkoutSession.sendToRemoteWorkoutSession(data: Data) will never return in some cases (no success nor failure). This issue is happening for roughly 5% of Workouts started and will stay broken for the whole workout. The other 95% of the workouts, the connection works flawlessly. This happens on both watchOS 10 and 11, and with phones running iOS 17 or 18. The issue is quite random and not reproducible. Our app has thousands of workouts a day that use the workout session workout data send, with constant messages being send every few seconds. In some of those 5% cases the "sendToRemoteWorkoutSession" will throw way later, like 30+ minutes later, if the watch app is awake long enough to capture a log of a failure. Our code uses the same flow as in the sample project: https://developer.apple.com/documentation/healthkit/workouts_and_activity_rings/building_a_multidevice_workout_app Here is some sample code, which is pretty simple. Setup code: let workoutSession = try HKWorkoutSession(healthStore: healthStore, configuration: configuration) workoutSession.delegate = self activeWorkoutSession?.startMirroringToCompanionDevice { success, error in print("Mirroring started on companion device: \(success), error: \(error)") } workoutSession?.prepare() then later we send data using the workout session: do { print("Will send data") try await workoutSession.sendToRemoteWorkoutSession(data: data) print("Successfully sent data") // This nor the error may be called after waiting extensive amounts of time } catch { print("Failed to send data, error: \(error)") // This nor the success may be called after waiting extensive amounts of time } So far, the only fix is to restart the phone and watch at the same time, which is not a great user experience. Is anyone else seeing this issue? or know how to fix this issue?
0
0
201
Nov ’24
Bring iOS app to foreground from Apple Watch app
Exploring Live Activity feature for Apple Watch right now and found that it has this default view with "Open on iPhone" button when you tap Live Activity. That button perfectly brings iOS app to foreground as if you tapped iOS's Live Activity. Is there a way to mimic that behavior from inside Watch app code? From inside WKApplicationDelegate, for example Tried openSystemURL but it seems lile it's only available for tel or sms links
1
0
228
Nov ’24
The screen of the watchOS app automatically turns off and pauses operation.
I developed a watchOS app to capture gyro data, save it in real-time as a CSV file, and send it to an iOS app. However, when I start writing with the watch on, the screen dims, and it stops working. It only resumes operation when I tap the screen again. Is there a way to let it run in the background and transmit files in real-time, even when the screen is off?
0
1
399
Nov ’24
Sharelink in WatchOS and Messages App
I’m relatively new to SwiftUI, so I’ve got a pretty basic question here. In my watchOS app, I’m using ShareLink to share a string of text to the Mail and Messages apps. Mail shows up in the ShareLink sheet just fine, but Messages doesn’t appear. What’s odd is that when I run the app in Xcode’s preview or in the Simulator, Messages does show up as a sharing option… So now I’m wondering if this is just a quirk with my device or if Apple doesn’t actually support sharing text to Messages from third-party watchOS apps yet? I know some Apple Watch apps (like Contacts) do support sending text/files to Messages, so I’m curious if anyone’s had a similar experience or knows more about this. Any insights would be super helpful!
5
2
259
4d