Watch Complications

RSS for tag

Display timely and relevant information about your app on the Apple Watch face using Complications.

Complications Documentation

Posts under Watch Complications tag

56 Posts
Sort by:
Post marked as solved
1 Replies
617 Views
Hello Community! We have an Apple Watch app that intensively uses ClockKit complication API. As to the release of WatchOS 10, ClockKit has been deprecated. The question is what time do developers have to make complete transition to WidgetKit? How long WatchOS will support ClockKit complications?
Posted
by
Post not yet marked as solved
0 Replies
1.2k Views
I updated my project from watch app + extension to single-execute project with Xcode 15. Then add a widget target to watch app. The new WidgetKit swiftUI complications works well on simulator, but not shown on the real device.(can not find on Apple Watch Face Complication Editor or rectangle widget) I tried: clean xcode build && Derived Data. reboot my watch/iphone delete all old clockkit complication settings & complicationcontroller.swift the watch still show old clockkit complicaton , that very buggy. so I try next: 4. restore my watch and pair it again. The new WidgetKit complication still not shown, it very frustrated. Do I have to change my old watch app to swiftUI lifecycle project to work? But code is works onthe simulator, which doesn't make sense. when I debug widget extension on Xcode, it show error: SendProcessControlEvent:toPid: encountered an error: Error Domain=com.apple.dt.deviceprocesscontrolservice Code=8 "Failed to show Widget 'hltek.***.watchkitapp.ComplicationWidget' error: Error Domain=FBSOpenApplicationServiceErrorDomain Code=1 "The request to open "com.apple.Carousel" failed." UserInfo={NSLocalizedFailureReason=The request was denied by service delegate (IOSSHLMainWorkspace) for reason: BadArgument., NSLocalizedDescription=The request to open "com.apple.Carousel" failed., BSErrorCodeDescription=RequestDenied, NSUnderlyingError=0x15687310 {Error Domain=FBSOpenApplicationErrorDomain Code=2 "(null)" UserInfo={NSUnderlyingError=0x15696b00 {Error Domain=com.apple.Carousel.ComplicationExtensionDebuggingErrorDomain Code=3 "No widgets available to reload" UserInfo={NSLocalizedFailureReason=No widgets available to reload}}}}, FBSOpenApplicationRequestID=0x16e7}." UserInfo={NSUnderlyingError=0x15684f10 {Error Domain=FBSOpenApplicationServiceErrorDomain Code=1 "The request to open "com.apple.Carousel" failed." UserInfo={NSLocalizedFailureReason=The request was denied by service delegate (IOSSHLMainWorkspace) for reason: BadArgument., NSLocalizedDescription=The request to open "com.apple.Carousel" failed., BSErrorCodeDescription=RequestDenied, NSUnderlyingError=0x15687310 {Error Domain=FBSOpenApplicationErrorDomain Code=2 "(null)" UserInfo={NSUnderlyingError=0x15696b00 {Error Domain=com.apple.Carousel.ComplicationExtensionDebuggingErrorDomain Code=3 "No widgets available to reload" UserInfo=0x1567e360 (not displayed)}}}, FBSOpenApplicationRequestID=0x16e7}}, NSLocalizedDescription=Failed to show Widget 'hltek.***.watchkitapp.ComplicationWidget' error: Error Domain=FBSOpenApplicationServiceErrorDomain Code=1 "The request to open "com.apple.Carousel" failed." UserInfo={NSLocalizedFailureReason=The request was denied by service delegate (IOSSHLMainWorkspace) for reason: BadArgument., NSLocalizedDescription=The request to open "com.apple.Carousel" failed., BSErrorCodeDescription=RequestDenied, NSUnderlyingError=0x15687310 {Error Domain=FBSOpenApplicationErrorDomain Code=2 "(null)" UserInfo={NSUnderlyingError=0x15696b00 {Error Domain=com.apple.Carousel.ComplicationExtensionDebuggingErrorDomain Code=3 "No widgets available to reload" UserInfo={NSLocalizedFailureReason=No widgets available to reload}}}}, FBSOpenApplicationRequestID=0x16e7}.} Domain: DTXMessage Code: 1 User Info: { DVTErrorCreationDateKey = "2023-07-06 03:36:45 +0000"; } -- System Information macOS Version 13.4.1 (Build 22F2083) Xcode 15.0 (22221.2) (Build 15A5195k) Timestamp: 2023-07-06T11:36:45+08:00 dyld[459]: Symbol not found: _$s21DeveloperToolsSupport15PreviewRegistryPAAE7previewAA0D0VvgZ Referenced from: <E835EDE1-190A-33B0-9462-EFD25999365D> /private/var/containers/Bundle/Application/F2DE6431-DF97-472D-934F-B2B3F76E660E/*** WatchKit App.app/PlugIns/ComplicationWidgetExtension.appex/ComplicationWidgetExtension Expected in: <E4C8E0EA-CF6C-381C-877C-716427DD3DFB> /System/Library/Frameworks/DeveloperToolsSupport.framework/DeveloperToolsSupport debug the extension on simulator with no error.
Posted
by
Post not yet marked as solved
1 Replies
583 Views
In Xcode 15 beta 1 to 5, the watch face preview of accessoryRectangular and accessoryCircular are always rendered in tinted mode, even if you choose multicolor. (NOTE: Please don't ask me to provide diagnostic data for Preview. Because this issue is 100% reproducible.)
Posted
by
Post not yet marked as solved
1 Replies
580 Views
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 } }
Posted
by
Post not yet marked as solved
3 Replies
1.2k Views
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.
Posted
by
Post not yet marked as solved
1 Replies
323 Views
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
Posted
by
Post not yet marked as solved
10 Replies
3.2k Views
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!
Posted
by
Post marked as solved
4 Replies
766 Views
I've migrated my ClockKit complication to WidgetKit in my app. Everything is working fine when I run the app on watch OS 9.4 simulator with Xcode 14.3.1 But when I compile withe Xcode 15 Beta 8 ( or beta 7, 6..), the invalidateConfigurationRecommendations() does not work anymore. the Recommendations() func from the IntentTimelineProvider is not called and thus the complication/widget list is not updated for the user The rest is working fine, all widgets are well displayed, and I can still add / change any widget from the original list. Running the app on a watchOS 10 simulator using Xcode 14.3.1, I've succeeded to see an error message : [widget] invalidateConfigurationRecommendations() - error reloading supported intents: Process not authorized to make this timeline request But I could not find any information about this error I've also tried by migrating the SiriIntent to AppIntent on Xcode 15 Beta 8, but the issue persists, Recommendations() is still not called upon invalidateConfigurationRecommendations() The application project is composed of : iOS App watchKit App WatchKit Extension Widget Extension (for IOS App) Widget Intent (for iOS App) Complication Extension (for watchOS widgets) Looking desperately how to fix this... Thanks for any help
Posted
by
Post not yet marked as solved
2 Replies
651 Views
I'm in the process of migrating one of my app's Apple Watch complications from ClockKit to WidgetKit. In my ClockKit complications, there are some cases where a show the relative time since the last event in the app (for example, "25MIN"). With ClockKit, this was quite straightforward using a CLKTextProvider designed for this exact purpose: CLKRelativeDateTextProvider(date: date, style: .offsetShort, units: [.hour, .minute]) This has always worked great, since it lets me specify that hours and minutes should be used, but not seconds, since they're not relevant here. How can I accomplish the same thing with WidgetKit and SwiftUI? The closest thing I've found is this: Text(date, style: .relative) It shows, for example: 14MIN 8SEC This is not what I want, since it shows seconds. It makes the complication look messy with all the extra information, and is distracting because it updates every second until an hour has passed. I suppose I could write my own logic to create a new timeline entry every minute to show the number of hours and minutes since the last update, but since CLKTextProvider works so nicely I wanted to check whether there is some way to accomplish the same thing without creating a new entry for every minute. There seem to be some more customizable options with date formatters, but I haven't found a way to combine this with the SwiftUI version that updates automatically on the Apple Watch face: https://developer.apple.com/documentation/foundation/date/relativeformatstyle/3766585-presentation
Posted
by
Post not yet marked as solved
1 Replies
1.2k Views
In my Watch app on watchOS 9 I was using .foregroundColor(myColour) to colour the text in a widgetLabel on a corner complication like this: let myColour: Color = functionThatReturnsAColorObjectConstructedLike Color.init(...) // green .widgetLabel { Text(myText) .foregroundColor(myColour) } It worked fine; the widget label was green. Now, in watchOS 10, I see that foregroundColor() is being deprecated in favour of foregroundStyle(), and I can use .foregroundStyle(.green), and - importantly - foregroundStyle() is only available on watchOS 10 and newer. myColour is calculated depending on some other info, so I can't just write .green, and when I use .foregroundStyle(myColour) the widget label comes out as white every time, even if I set myColour = .green. I think I have to use some sort of extension to pick the right combination, something like: extension View { func foregroundType(colour: Colour, style: any ShapeStyle) -> some THING? { if #available(watchOS 10.0, *) { return foregroundStyle(style) } else { return foregroundColor(colour) } } } // Usage let myStyle: any ShapeStyle = SOMETHING? ... .widgetLabel { Text(myText) .foregroundType(colour: myColour, style: myStyle) It doesn't work. I just can't figure out what should be returned, nor how to return it. Any ideas?
Posted
by
Post marked as solved
2 Replies
592 Views
I just got my new Apple Watch series 9 - woo! But I loaded a couple of my test apps onto it - and the complications are not rendering. They work fine on my "old" series 6 (both are on WatchOS 10). I tried resizing them. They run and render fine in the simulator. But this is how it looks on my actual watch (the upper 2 complications are mine).
Posted
by
Post not yet marked as solved
1 Replies
619 Views
The modular ultra watchface ignores the font type I set in my complication. Happens in simulator and on device (see screenshots). I set the font via: .font(.system(size: CGFloat(self.fontSize), weight: self.fontWeight, design: .monospaced)) Can you please help? Is this as designed or a bug? I really a monospaced font in that place. Thanks! Correct: Wrong:
Posted
by
Post not yet marked as solved
0 Replies
390 Views
I have a watch extension app that is used to show the complications using ClockKit. Then when we upgraded to watch OS 9, I added the WidgetKit Extension and all migration code for clockKit as well. Everything was working fine in Watch OS 9 But now when we upgraded to watch OS 10. The widgetKit based complication not at all running, I can't even see any of our complication in watch face On top of that the WidgetKit extension is not showing any debug information as well, none of the break points are executed Please let me know if anyone knows the issue
Posted
by
Post marked as solved
2 Replies
750 Views
Current project structure: Main iOS app (targets iOS 17). Widget Extension (targets iOS 17). Watch app (targets watchOS 10). Complications Extension (a Widget Extension, targets watchOS 10). I did have the complications embedded within the Watch app, but you cannot have two @mains in the same target so the complications are in their own WidgetKit extension. Sadly, when you add a WidgetKit extension to your project, Xcode ALWAYS sets it as an iOS widget extension; it doesn't give you the choice to make it a watchOS extension so you have to figure it out yourself. Now, I'm hitting an issue where the main iOS app works fine, the iOS widgets work fine, the Watch app runs fine, but the complications dot show up anywhere. I can't preview them in Xcode because it says various things like: This app was not built to support this device family; app is compatible with ( 1,2 ) but this device supports ( 4 } I can't find any information on what goes where in the build settings. Can someone tell me how each bit of the project should look in the build settings, please? (There's no information anywhere in Apple's developer documentation - which is a bit weird. They've released Xcode and they have no information on the various bits. And why doesn't Xcode set up a WidgetKit extension properly when you add it? Must we all do this manually, Apple?)
Posted
by
Post not yet marked as solved
0 Replies
539 Views
Prior to watchOS10, I marked a view that I want to hide sensitive information when not being worn by using .privacySensitive() This had been working just fine. Comes watchOS10, this doesn't work anymore. Even with this simple code Text("TEST Privacy") .containerBackground(for: .widget) { Color.black } .privacySensitive() The text view is displayed even when not being worn. Has anyone experienced this? It seems like a bug to me. Any workaround? Thank you.
Posted
by
Post not yet marked as solved
1 Replies
524 Views
I'm trying to find the best way to reload my Widgets and Complications. My App tries to show the current status vehicles. It gets the data using an API. And you don't know when this status changes. So I need to know when it makes sense to reload the widgets and complications. Here is a quote from the documentation: A widget’s budget applies to a 24-hour period. WidgetKit tunes the 24-hour window to the user’s daily usage pattern, which means the daily budget doesn’t necessarily reset at exactly midnight. For a widget the user frequently views, a daily budget typically includes from 40 to 70 refreshes. This rate roughly translates to widget reloads every 15 to 60 minutes, but it’s common for these intervals to vary due to the many factors involved. This is by far the worst "definition" if ever seen :( There is a 24 period, but you don't know when it starts and you don't know how much max refreshes you have and you also don't know how many refreshes you have left. How should someone develop a good solution with such a "definition"? So, I would like to know how you handle this? Perhaps a Apple engineer could light me up here :)
Posted
by
Post not yet marked as solved
2 Replies
538 Views
Just finalising some work on my app update, and it seems that when you go to select an item to show in a complication, when you select your app in the list, the subsequent list only shows 15 of your items. If a user of my app has transferred 20 items to their Watch, they can't select five of them to be shown in a complication. Is that right? If that's a hard limit then I need to be able to separate them out into bunches of 15 items, or maybe have them display under A-E, F-J etc. Does this have to be done as a separate Widget in the WidgetBundle? And how do I do that? Given that I currently have one widget in that bundle that should show everything (20 items), how would I split it out to show an "A-E" widget with those items beginning with A...E? Do I have to have an A-E widget with its own set of data?
Posted
by
Post not yet marked as solved
2 Replies
620 Views
I'm developing my app for WatchOS 10 with Xcode 15.0.1. I'm trying to make a complication with WidgetKit (SwiftUI) to make it easier the user to launch the app. I'm using a simple and small image 50x50px to test it first. But when I try to add to the Watch Face, it show a gray circle like there is nothing there. But when i'm editing the Watch Face it show the image :/, like the image bellow: And another problem is when is Accent mode, it fills the image with a gray color, as the image above shows it. I tryed to add monochrome png image with the alpha-channel, but even that didn't worked too. And my code is simpler has that: var body: some View { Image("Cat") } Someone is facing this same problem? Has any possible solution.
Posted
by
Post marked as solved
2 Replies
854 Views
2 years ago using Xcode 13, I created a phone app with a companion Watch app and it worked fine. This past month using Xcode 15, I created a new phone and companion app and everything is working with the following exception. From Xcode, my new app installs on the phone and watch, but my Watch app doesn't show up in the list of apps you can use as a launch complication on one of your watch faces. The app does show up in the launch screen for apps installed on the watch, so I assume the watch icon is generated properly. I started out using a single 1024x1024 app icon so I thought maybe I needed to create all variations of the icon before I'd see them as a complication option. I created all variations and loaded them in the Appicon asset. Still no luck. the one major difference between my Xcode 13 and Xcode 15 projects is the 15 project includes one watch app, where the 13 project includes the watch app and a WatchKit extension. my understanding is Xcode 14 and 15 don't use WatchKit Extension. So... what do I need to do to be able to add my Xcode 15 watch app icon to a watch face so I can launch the app from there?
Posted
by