WatchKit

RSS for tag

Build apps that leverage watchOS features like background tasks, extended runtime sessions, and access to the Digital Crown using WatchKit.

Posts under WatchKit tag

132 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

error on upload on app store
I get this error with xcode 16.1 uploading to app store: Asset validation failed Invalid Info.plist key. The key 'UIBackgroundModes' in bundle new3bmeteo.app/Watch/new3bmeteowatch.app/PlugIns/new3bmeteowatch Extension.appex is invalid. (ID: a1e48ae9-5b51-4252-99e7-116b6359cb39) info.plist: // some other things UIBackgroundModes location
6
8
198
2d
Defer system gestures in a WatchKit app
Hi, I'm making a WatchKit game app with SpriteKit and Objective-C, and I'm encountering an annoyance where system gestures, namely long-pressing the top and bottom edges to pull Notification/Control Center, interfere with the controls of the game. In iOS, this can be mitigated by using overriding preferredScreenEdgesDeferringSystemGestures in UIViewController, but I couldn't find any equivalent API in any WatchKit class, and searching for similar symbols only yielded a single private API (-[_UISystemAppearanceManager screenEdgesDeferringSystemGestures]) that isn't ever called on watchOS. Any idea how to achieve a similar effect on watchOS?
1
0
88
3d
Screen on Apple watch turn off even when "Always On" is active
Our company has developed a product available, which measures body composition. During the measurement process, lasting 40 seconds, we require the device screen to remain illuminated. We are actively using the "Always On" feature and have set the timer on the watch to 70 minutes to prevent the screen from dimming. However, we are encountering issues where the screen may still turn off during the measurement. Could you please provide guidance on how to keep the screen active with backlighting across all Apple Watch models during measurements?
1
0
113
2d
Local notification not working with ios app installed
I have an iOS and watchOS app where both can run independently, I am not using WatchConnectivity to send data back and fourth. The issue I'm having is that if I schedule a local notification on the watch and the phone is unlocked, it will not show on the watch for about 10-15 seconds. If I uninstall the iOS app or have the phone locked, it will show immediately on the watch. To my understanding, this is somewhat the expected functionality but is there a way to bypass it? My app is a timer app and it really should not have a delay.
2
0
202
2w
Text(date, style: .timer) issues with watchOS widget
I'm using Text(date, style: .timer) to display a timer in a WatchOS widget, which works great. The problem is that when the watchface goes dim the time goes from showing the time as "MM:SS" to showing "M minutes". Why is this occuring and how can I change the behavior? I understand it needs to remove seconds to preseve battery life, but why it is putting the word "minutes" at the end, this is messing up my layout. Thanks.
1
0
161
2w
My Custom Watchface
Dear all, i am a music conductor and developer, and to fulfill my joy with music i recently developed a WatchFace and some apps for a non-apple watch called "PineTime". My whole development is done in c++ and is available at https://github.com/luto65/PineConductor/ Since I am aswell an apple developer, and most of my friends have apple watches, i am now porting those c++ apps to the apple watch. I just finished the very first one, that is actually a watch Face I now ported it to appleWatch and it looks pretty similar too (here a screenshot from the simulator) I would like to now remove the annoying digital hour on the top right corner, and then sell it as new custom face, together with my other swift-ports of my original c++ applications. Looking forward any feedback.
1
0
151
3w
Can I fix this big difference between swiftui preview and actual watch widget layout?
Hi, working on customising my live activity Smart Stack layout for ios18. A thing that is very frustrating is that I consistently looks different for me in the Xcode preview and on the actual watch. See attached screenshots below. The sizes are different, and italic doesn't work on the watch, for example. It makes it time-consuming and unpredictable, so I was wondering if this is a known issue or if I'm doing something wrong, and also can I do anything? thanks edit: this is the layout: var body: some View { VStack(alignment: .center, spacing:4) { HStack(alignment: .center) { IconView(resource: "n-compact-w", bgColor: Color.checkedIn, padding: 2, paddingRight: 6, paddingBottom: 6) .frame(maxWidth: 25, maxHeight: 25).aspectRatio(1, contentMode: .fit) Text("Checked Out") .font(.title3).bold() } Text(status.loc) .font(.headline) .multilineTextAlignment(.center) Text(FormatUtils.getFormattedDateTime(status.time)).font(.subheadline) .multilineTextAlignment(.center).italic() } }
4
0
204
3w
Optimize watchOS CMSensorDataList parsing
I am trying to parse CMSensorDataList in watchOS. The maximum batch of data is comprised of 30 minutes. The sampling rate is 50Hz, which makes it 90,000 records for 30 minutes. We iterate over each item and finally write the data to a CSV file. As this is a slow processing keeping in view the execution limits of watchOS, the process suspends when app goes to the background. This way, it takes too much time to parse a significant time data. My question is, is there a way we can serialize this CMSensorDataList as a whole and transfer it to the phone using WCSession? Or is there another effective way to achieve this?
0
0
91
3w
How can I use an image for my live activity smartstack layout?
Hello, I am updating my live activity for the new ios18 Smart Stack functionality. I got it working through the WWDC session (Bring your live activities to Apple watch). I'm doing supplementalActivityFamilies([.small]) and then a custom layout in the .small ActivityFamily However, any images I try to use in the Smart Stack just show up as grey squares. (it works on the phone live activity) I suspect it's because my app images are not moved over to the watch? Because I don't have a watch app and such no watch target? If anyone can help me understand if there's anything I can do in order to have a custom image show up on the smart stack, I'd be very grateful.
3
0
180
4w
Hand Gesture Controls in an Apple Watch App
Hello everyone! I want to add hand gesture controls to my Apple Watch app. Specifically, I’m looking to implement the following gestures: 1. Tapping index finger and thumb together once 2. Tapping index finger and thumb together twice 3. Fist clench 4. Double fist clench Each gesture should trigger a different action within the app. However, I can’t find any information on how to implement this. I only came across an example using .handGestureShortcut(.primaryAction) (Enabling the double-tap gesture on Apple Watch https://developer.apple.com/documentation/watchOS-Apps/enabling-double-tap), but I need to handle four distinct gestures. Is this possible in watchOS 11? Any guidance or examples would be greatly appreciated! Thank you!
1
0
198
4w
WatchOS local notifications delayed
I'm scheduling local notifications on my WatchOS app, but they are always alerting exactly 13 seconds later than scheduled. I have read other users having the exact same issue but there is no solution anywhere. I'm not sure how one is supposed to write any sort of timer app when they are always coming in delayed. Any idea why this occurs and how to resolve it? For now I am subtracting 13 seconds from the end time, but that's not really a solution I'm happy with. Thanks
2
0
218
3w
How to disable Live Activity on Apple Watch while keeping it enabled on iPhone?
I'm using Live Activity features in my app, but I want to customize the user experience across different Apple devices. Specifically, I'd like to: Keep Live Activity enabled and functioning on the iPhone Disable or prevent Live Activity from appearing on the connected Apple Watch Is this level of device-specific control possible with Live Activity? If so, what's the best approach to implement this functionality? What I've tried: I've looked through Apple's documentation on Live Activity, but couldn't find specific information about device-level control. I've experimented with ActivityKit, but haven't found a clear way to distinguish between iPhone and Apple Watch when pushing updates.
4
0
339
3w
Getting kclErrorDomain error : 1
Hi, I created an iOS app compatible watchOS app which was running perfectly fine before I updated my Xcode to use iPhone16. But after updating, I started to get kclErrorDomain error: 1 and I am not sure why is it happening after update. I am trying to use coreLocation module as- import Foundation import CoreLocation import Combine class LocationManager: NSObject, ObservableObject, CLLocationManagerDelegate { private var locationManager = CLLocationManager() @Published var location: CLLocation? override init() { super.init() locationManager.delegate = self locationManager.desiredAccuracy = kCLLocationAccuracyBest locationManager.requestWhenInUseAuthorization() locationManager.startUpdatingLocation() } func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) { if let location = locations.last { self.location = location print("Updated location: \(location.coordinate.latitude), \(location.coordinate.longitude)") } else { print("No locations received") } } func locationManager(_ manager: CLLocationManager, didFailWithError error: Error) { print("Failed to find user's location: \(error.localizedDescription)") } } and I am trying to use it as- @StateObject private var locationManager = LocationManager() guard let currentLocation = locationManager.location else { signInError = "Location not available" isLoading = false return } let latitude = currentLocation.coordinate.latitude let longitude = currentLocation.coordinate.longitude sendToBackend(email: email, password: password, deviceName: deviceName, deviceModel: deviceModel, deviceIdentifier: deviceIdentifier, latitude: latitude, longitude: longitude) Can someone help me regarding this?
1
0
166
4w
SwiftUI - WatchKit TextField Keyboard closed immediately before entering text
The TextField Shows and When selected opens the keyboard very slowly and before entering text closes immediately with these messages. <PUICQuickboardController: 0x6000029111f0> [0x6000029111f0-1] presentation watchdog expired! <PUICQuickboardController: 0x6000029111f0> [0x6000029111f0-1] is no longer the current presentation, we must have timed out... This App was working fine in Simulator and test devices until recently.
0
0
175
Oct ’24
Casting `[String: Any]` to `[String: any Sendable]`
I have a simple wrapper class around WCSession to allow for easier unit testing. I'm trying to update it to Swift 6 concurrency standards, but running into some issues. One of them is in the sendMessage function (docs here It takes [String: Any] as a param, and returns them as the reply. Here's my code that calls this: @discardableResult public func sendMessage(_ message: [String: Any]) async throws -&gt; [String: Any] { return try await withCheckedThrowingContinuation { (continuation: CheckedContinuation&lt;[String: Any], Error&gt;) in wcSession.sendMessage(message) { response in continuation.resume(returning: response) // ERROR HERE } errorHandler: { error in continuation.resume(throwing: error) } } } However, I get this error: Sending 'response' risks causing data races; this is an error in the Swift 6 language mode Which I think is because Any is not Sendable. I tried casting [String: Any] to [String: any Sendable] but then it says: Conditional cast from '[String : Any]' to '[String : any Sendable]' always succeeds Any ideas on how to get this to work?
3
1
310
Oct ’24
App Not Appearing in "Available Apps" List in Watch App
I’ve developed an Apple Watch extension for an existing iOS app. When I run the app on the watch via Xcode using the simulator, everything works fine. However, when I try to install it on my iPhone, the Watch app doesn’t show it in the "Available Apps" list, so I can't install it on the watch. The Apple Watch is connected to my iPhone, and I can see other apps available for installation without any issues. I also created a brand new project with watchOS support to troubleshoot, but the same problem occurred. Any ideas on how to resolve this?
0
0
195
Oct ’24