watchOS is the operating system for Apple Watch.

Posts under watchOS tag

200 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

Complications cannot be added to watch screen
I am having problems adding Swift applications to a watch face. I thought it was my App, so I took the default App created by Xcode (Hello World) and I get the same problem. Using Xcode 14.3.1 and Watch OS 9.5.2. I can get the App to run on the watch by the standard method of attaching cable from MacBook to iPhone and the App appears on the phone and in the Dock and runs just fine. But when I go to add the App to a screen face as a complication, it won't be found in the list of Apps.
2
0
258
Jul ’23
Question Regarding iPhone Restart with Apple Watch App Still Turned On
I am currently in the process of developing an iPhone app along with its corresponding Apple Watch app. After turning on both apps, I proceed to terminate them completely. However, when I solely turn on the Watch app, I can see the splash screen running smoothly on the Watch screen. Strangely, when I turn on iPhone app(the watch app is running), there are times when the iPhone app's splash screen appears to be skipped(this behavior is not consistent.) Upon experimenting and changing the order of app launches (iPhone app first, followed by the Watch app), the splash screen of the Watch app is never skipped. I'm curious to understand the reason behind this behavior. Could someone shed some light on why this is happening? Any insights would be greatly appreciated!
1
0
217
Jul ’23
Apple Watch cannot reconnect
None of my existing apps (both in-AppStore and in-development) nor even a brand new WatchOS app can be installed to my Apple Watch. While using Xcode to build and deploy to my Watch, I get this: ”Waiting to reconnect to Apple Watch Xcode will continue when the operation completes.” However, this dialog persists and never completes. I’m running all of the latest: MacOS 14 beta 4, Xcode 15 beta 5, Watch OS 10 beta 4, iOS 17 beta 4. I’ve tried resetting my Watch (with “Erase All” option) and restarting the Mac, the phone and the watch. Any help?
37
11
12k
May ’24
watchOS SwiftUI application deeplink on push notifications
Hey, I am currently trying to add deeplink handling from tapping on push notifications in my watchOS application with a SwiftUI lifecycle. I already have deeplinking working with several onOpenURL modifiers throughout the app for the iOS version. What I wanted to do, is whenever I receive a push notification I construct an URL and then utilise the onOpenURL view modifier to handle the deeplink. I currently struggle to understand if this is possible at all. I have the following setup @main struct WatchApp: App { @WKApplicationDelegateAdaptor var appDelegate: WatchAppDelegate // MARK: - Body var body: some Scene { WindowGroup { ContentView() } } } class WatchAppDelegate: NSObject, WKApplicationDelegate, ObservableObject { func applicationDidFinishLaunching() { UNUserNotificationCenter.current().delegate = self } } extension WatchAppDelegate: UNUserNotificationCenterDelegate { func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse) async { // handle the push notification } } I do receive the the notification as expected in userNotificationCenter(center:, didReceive:) but from there on I didn't find a way bring this information into my app. On iOS I do leverage UIApplication.shared.open(url:) but this is obviously not available on watchOS. What is the official guidance of handling watchOS deep links with SwiftUI lifecycle from tapping of push notifications ? Currently the onOpenURL modifiers are placed on several views, so it would be nice if there is a way to trigger them from a central place. Would be really appreciated if someone knows a way on how to do it :)
0
0
848
Jul ’23
watchOS App Pushed to Foreground After Workout
I built a workout app for watchOS. After finishing the workout, I'm noticing that the system repeatedly pushes the app to the foreground, even if I push the app to the background after the workout. It is unclear why this is happening. I followed Build a workout app for Apple Watch and I correctly finish the workout as far as I'm aware, with no errors being throw by the system or HealthKit. What could be causing this behavior? In other words, in what scenario does the system push an app to the foreground (after completing a workout)? Note that I'm not using WorkoutKit, just HealthKit. I tested this on a physical device, Apple Watch Series 8, running watchOS 9.6.
1
0
569
Aug ’23
Refreshing AppIntentRecommendation or IntentRecommendation
In my watch app the AppIntentRecommendation that is returned by func recommendations() needs to be updated after the app is launched. Problem: The information that I need to return a list of AppIntentRecommendation is not available when the app is first installed, so I return a "dummy" AppIntentRecommendation initially. After the app is launched for the first time and user has signed in, I can update the AppIntentRecommendation in func recommendations() but watchOS does not update the list of widgets presented as complications. func recommendations() -> [AppIntentRecommendation<ConfigurationAppIntent>] { // Create an array with all the preconfigured widgets to show. let defaults = UserDefaults.init(suiteName: "group.myApp")! guard let names = defaults.dictionary(forKey: "names" as? [String:String] else { return [AppIntentRecommendation(intent: .Demo, description: "Demo")] } var recs = [AppIntentRecommendation<ConfigurationAppIntent>]() for (idx, name) in names() { let rec = ConfigurationAppIntent() rec.order = idx rec.carName = name rec.action = nil recs.append(AppIntentRecommendation(intent: rec, description: "name") ) } return recs } }
1
0
651
Sep ’23
Userdefaults for complications are nil while watch is working fine
I'm able to successfully send userdefaults from the phone to the watch using applicationContext and save those userdefaults to the app group I created. For the watch, I see all the userdefaults come in successfully and I'm able to use them in the WatchOS app. Once I created the complications for the watch app, I am using the same app group ID and I added that app group in the capabilities of the watch extension but when I try to use the same userdefault that I'm using for the watch, everything is nil. I'm not understanding what I'm doing wrong. How do I share userdefaults between the watch and complication? This is how I'm bringing in the userdefaults from the phone to the watch let defaults = UserDefaults(suiteName: K.appGroupID) if let value1 = applicationContext["lat"] as? Double { defaults?.setValue(value1, forKey: "lat") } if let value2 = applicationContext["lng"] as? Double { defaults?.setValue(value2, forKey: "lng") } ... I am able to use this exact function in the watch app, but in the complication, the userdefault is nil. let formatter = DateFormatter() formatter.timeStyle = .short formatter.timeZone = .current let defaultLoad = UserDefaults.init(suiteName: K.appGroupID) if defaultLoad!.bool(forKey: "timeFormat") == true { ... I tried to remove and re-add the app group but that didn't work either. I also created a separate app group for the watch and extension to use alone but still same issue.
4
1
1.5k
Aug ’23
WatchOS NavigationSplitView never shows detail: { }
I built a quick WatchOS app that uses an @Model to populate a List within a NavigationSplitView. After several minutes, the List displays the data which is in my CloudKit database - so far so good. Unfortunately, when I attempt to tap on any of the List items, the detail view is never displayed. Here is the ContentView: import SwiftUI import SwiftData struct ContentView: View { @Query(sort: \Squats.date, order: .reverse) var exercises: [Squats] @Environment(\.modelContext) var modelContext @State var selectedExercise: Squats? = nil var body: some View { if exercises.count == 0 { Text("CloudKit not yet loaded") } else { NavigationSplitView { List (exercises, selection: $selectedExercise) { ex in Text(ex.date.format("E, MM/dd")) } } detail: { Text(selectedExercise?.exercise ?? "Nothing set") } .padding() } } } And here is the model view: import Foundation import SwiftData @Model class Squats { var date: Date = Date() var exercise: String = "" init(date: Date, exercise: String) { self.date = date self.exercise = exercise } } I’ve tried this on a number of my in-production DBs, as well as this development-only “Squats” DB - same lack of detail view on all. Thoughts?
4
0
733
Aug ’23
Companion app can't be installed on iPhone for some users who have installed the watchOS only version app
Hello! I'm facing the following Appstore issue. There was an watchOS only app, without a companion app. In current 1.6 version the app has a companion app and it can be properly installed by new users from their iPhones or watches. Unfortunately, all old users, who have installed the app from their watches don't see a way to install the app from the Appstore (they can download the latest watchOS version though). Many things have been tried - uninstalling, installing on the watch. Looking for a purchase, removing subscription, but without luck. The Appstore shows "purchased" button instead "Get" or the cloud icon. Is this a bug in the Appstore or there is a way to recover from this edge case. Thanks, Emil
2
1
686
Sep ’23
Please adopt containerBackground API
After updating to the Xcode beta and build/running my app, I started to get an error on all my widgets "Please adopt containerBackground API" and I found a post that had a solution to accommodate iOS 14-16 import Foundation import SwiftUI extension View { @ViewBuilder func widgetBackground() -> some View { let gradient = LinearGradient(gradient: Gradient(colors: [Color("LightBlue"), Color("DarkBlue")]), startPoint: .topLeading, endPoint: .bottomTrailing) if #available(watchOS 10.0, iOSApplicationExtension 17.0, iOS 17.0, macOSApplicationExtension 14.0, *) { self.containerBackground(gradient, for: .widget) } else { self.background(gradient) } } } I add this to my ZStack for the widget and it does nothing. I still get the same error to adopt to containerBackground API. What am I doing wrong?
0
3
1.9k
Aug ’23
Xcode 15 beta 5 / Watch OS 10 beta: .navigationBarBackButtonHidden(true) doesn't work with .sheet
Currently, I am adapting my app to watchOS 10 and the new navigation options. However, I want to keep the page call via PresentationAdaption .sheet, but using .navigationBarBackButtonHidden(true). In Xcode 14 and under watchOS 9 this has not been a problem so far, but in the new version the back button, newly introduced in watch OS 10, still appears. Is this a bug or a feature? And how do I get rid of this button? Circle() .onTapGesture { justDoIt = true } .sheet(isPresented: $justDoIt) { View() } .navigationBarBackButtonHidden(true)
0
0
340
Aug ’23
Location Accuracy Reduced on Apple Watch Ultra
Hello folks, I have been observing a strange behaviour on my Apple Watch Ultra. Device Environment: Apple Watch Ultra on WatchOS 10 Beta Offline Disconnected from companion iPhone Workout active: "Walking" Expected behaviour: The workout should record accurate locations (with accuracy of approximately 3-4 meters). This level of accuracy is already being achieved in the same watch (verified using several GPS status apps) when a workout is not active. . Observed behaviour: Accuracy as good as 2 meter is observed when no workouts are active, but as soon as the workout starts, the accuracy drops to a maximum of 14 meters and never gets better than this. This is confirmed to be happening every single time and is verified using several GPS status apps during the workout. Does anyone else has faced similar behaviour?
5
2
2k
Sep ’23
Apple Watch: Waiting for first unlock
After all these years I'm STILL getting this message. WHY hasn't Apple fixed this yet?! I'm on version Version 14.3.1. Is there any way to get this working? Developing for Apple Watch has been a total nightmare from day 1, I don't understand how it hasn't gotten any better. This error keeps me from testing my app on my Watch. My Watch is obviously unlocked. I tired every troubleshooting step I've read in the dozens of other posts about this issue.
1
0
563
Aug ’23
Shallow Depth and Pressure entitlement
Following https://developer.apple.com/documentation/coremotion/accessing_submersion_data I'm trying to "just get it started". I have a provisioning profile with the Shallow Depth and Pressure active, I have set the com.apple.developer.submerged-depth-and-pressure to true in the entitlements file, and get no errors or warning when compiling and starting the app on my Apple Watch Ultra. When my view appears, I init the submersion manager with the following code: guard CMWaterSubmersionManager.waterSubmersionAvailable else { return } submersionManager = CMWaterSubmersionManager() submersionManager?.delegate = self Logger.shared.info("SubmersionManager initialized") I get the printout SubmersionManager initialized, but then I get: An error occurred: The operation couldn’t be completed. (CMErrorDomain error 110.) Googling this error tells me this error means: CMErrorNotEntitled And I cannot find WHY the app is not entitled.. I find no information that this entitlement is not publicly available or anything.
3
0
1.2k
Jan ’24
Watch and apple fitness unable to start after one workout
Several times I've done an Apple Fitness + workout and ended the session when finished. I go to start another workout and the watch screen is dark and I cannot start another workout. I've done a hard reset and I can start a new workout. This has only happened after I downloaded the developer beta iOS 17 software. It will recognize a workout (walking) on its own if I've walked awhile and prompt me to start a workout
1
0
364
Aug ’23
WidgetKit complications won't update
We are migrating ClockKit complications to WidgetKit in our watch app (watchOS 9+). The migration went smoothly, UI part works just fine. However, we've hit the wall with widgets not updating when requested by the watch app. I believe we are missing something very simple and fundamental, but couldn't find what exactly so far. Advice and tips would be very welcome! 🙇‍♂️ Our implementation details: Whenever data is changed in the main app, the updated data is submitted to the watch app via WatchConnectivity framework using WCSession.default.transferCurrentComplicationUserInfo(_:). According to documentation, this method should be used to transfer complication-related data, since it will wake the watch app even if it is in the background or not opened at all. Watch app receives updated data and stores it in UserDefaults shared with Watch Widget Extension hosting WidgetKit complications via App Group. Watch app then request widget timeline reload via WidgetCenter.shared.reloadAllTimelines(). According to documentation, it reloads the timelines for all configured widgets belonging to the containing app, so it seems the appropriate way to reload WidgetKit complications. Widget Timeline Provider class in Watch Widget Extension reads updated data from shared UserDefaults and uses it to provide the updated snapshot for widget views to render. We believe our implementation logic is correct, but it doesn't work, for some reason. Widgets sometimes update when the watch app is opened, but not always. The most definitive way to force widgets to update is to switch to a different watch face, which confirms that the Widget Timeline Provider has access to properly updated data. P.S. We are aware of the daily reload budget imposed on widgets, so we use widgets reload trigger sparingly. Anyway, according to documentation, reload budget is not effective when in DEBUG mode, but widgets won't reload even in DEBUG mode. Thank you!
17
9
4.1k
1w