ClockKit

RSS for tag

Display app-specific data in the complications on the clock face using ClockKit.

Posts under ClockKit tag

36 Posts

Post

Replies

Boosts

Views

Activity

Does anyone implement getAlwaysOnTemplate in their App for Apple Watch Complications on the Always-On Display
I supported the Always-On display in my app complications from day one but since am continuing to find animation glitches and bugs that have never been fixed and exist currently on WatchOS 8 & 9 (I've tried Series 6 & 8 devices). I'm thinking about scrapping it and just returning the handler(nil). Does anyone have an example of where they use it and it really adds value to their app complications? And do they have any suggestions to try and work around the glitches? Thanks
0
0
1.5k
Jan ’23
watchOS 9.2 breaks the complicationForeground() modifier
I found that watchOS 9.2 seems to break the complicationForeground() modifier. In previous systems, a View modified by complicationForeground() was rendered white, while an unmodified View was rendered with the watch face tint color. This is the correct behavior. However, in watchOS 9.2, this behavior has been reversed. The View modified by complicationForeground() renders the tint color, and the opposite is white‽ This causes third-party complications to look very inconsistent on tinted watch faces. Of course, this issue belongs to ClockKit, and I'm not sure if there are similar issues in the new WidgetKit. Will this issue be fixed please?
4
0
1.9k
Dec ’22
Are old (CLKComplicationDataSource-based) complications still supported in new extensionless Watch targets?
Hello, I am migrating a watch app from older dual watch-app/watch-extension targets to a new extensionless target, but my complications seem to have lost the ability to update. I have set the CLKComplicationPrincipalClass key in Info.plist to my ComplicationController class (class ComplicationController: NSObject, CLKComplicationDataSource), but while the previews inside the complication picker show up correctly, the complications themselves stopped working on the watchface. Namely, they don't redraw anymore, when I refresh them like this: let complicationServer = CLKComplicationServer.sharedInstance() if let activeComplications = complicationServer.activeComplications { for complication in activeComplications { complicationServer.reloadTimeline(for: complication) } } Is there something I am missing? Some way of registering the CLKComplicationDataSource instance in SwiftUI watch app definition? Or is this not supported, and the only way forward is to rewrite all ClockKit complications to WidgetKit ones?
4
0
2.4k
Nov ’22
CLKComplicationDescriptor identifier for very old complications
I'm in the process of updating an app that uses complications that originally had a deployment target of watchOS 4.3. These complications used CLKComplicationSupportedFamilies defined in Info.plist. There are no CLKComplicationDescriptors in use. Updated complications that use a new CLKComplicationDescriptor.identifier display correctly in the complication picker, but the original complication that's using CLKDefaultComplicationIdentifier displays "--" or "---" depending on placement. This happens whether you are using a ComplicationController instance or WidgetKit. Using CLKDefaultComplicationIdentifier as the identifier when creating the CLKComplicationDescriptor doesn't work: the complication doesn't appear in the picker. My question is there a way to "upgrade" an older complication configured by the customer to a new complication identifier? I'm not using WidgetKit for this project so a widgetMigrator isn't an option. -ch
0
0
1.4k
Nov ’22
Equivalent of CLKComplicationTemplateGraphicCornerStackText in WidgetKit?
Trying to create a corner complication with curved text for watchOS 9. The documentation has pointed me to the ClockKit class CLKComplicationTemplateGraphicCornerStackText, but this is marked as deprecated since we are supposed to be moving to WidgetKit for everything. What would be the way to get this kind of curved text going forward?
2
1
1.1k
Oct ’22
How to reset `WCSession.remainingComplicationUserInfoTransfers` during watchOS complication development or testing?
Is there a way to reset the complication communication threshold WCSession.remainingComplicationUserInfoTransfers during development or testing? I tried deleting the app and reinstalling and this threshold does not appear to reset. During development we get only 50 tries per day? After that pack up and go home?
5
1
1.9k
Oct ’22
Clock widget
Is there a way to make the clock widget not say cup? I get that it’s short for Cupertino but it’s really tacky and ugly. Would prefer it to say nothing but the time... androids clock widgets have multiple skins to and have had them for like 10 years but all you got is some ugly analog clock that says cup. Cmon guys...
5
0
16k
Oct ’22
clock_gettime can't get the exact CPU time of thread on Mac with m1 chip
I used clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts) to get the CPU time of the thread but found that the time fetched through it on M1 was very small. The iPhone and non-M1 devices are fine. double CPUTime() { struct timespec ts; int ret = clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts); return ts.tv_sec + ts.tv_nsec/1000.0/1000.0/1000.0; } double RealTime() { struct timespec ts; int ret = clock_gettime(CLOCK_MONOTONIC, &ts); return ts.tv_sec + ts.tv_nsec/1000.0/1000.0/1000.0; } void longTask() { double begin = RealTime(); double limit = 1.0; static double g_result = 0; while (1) { for (int i=0; i<1000000; i++) { g_result = sin(g_result+5); } double now = RealTime(); if (now - begin >= limit) break; } return; } void testClocks() { double t1, t0, cpuTimeCost, realTimeCost; t0 = CPUTime(); longTask(); t1 = CPUTime(); cpuTimeCost = t1 - t0; double t10 = RealTime(); longTask(); double t11 = RealTime(); realTimeCost = t11 - t10; NSLog(@"\nthread cpu: %lfs\nreal: %lfs", cpuTimeCost, realTimeCost); return; } the output is: thread cpu: 0.024395s real: 1.006627s By contrast, on iPhone or Mac with an Intel chip, these two values are almost the same. Any help here? I've tried the Rosetta model and it's the same problem.
1
0
1.2k
Aug ’22
apple watch clockkit on background is not working even on sample code
https://developer.apple.com/documentation/clockkit/creating_and_updating_a_complication_s_timeline I just run sample app to check background delivery on health kit. I added caffein on my health app on phone. but it dosen't triggered on obeserver processUpdate function. func processUpdate(query: HKObserverQuery,             completionHandler: @escaping () -> Void,             error: Error?) {     print("processUpdate come!!!!")     logger.debug("Received an update from the background observer query.")           // Check for any errors that occur while setting up the observer query.     guard error == nil else {       logger.error("Unable to set up a background observer query: \(error!.localizedDescription)")       fatalError()     }           logger.debug("Responding to a background query.")           Task {               // Load the updated data from the HealthKit Store.       let success = await loadNewDataFromHealthKit()               // Check for any errors.       guard success == true else {         logger.error("Unable to query for new or deleted caffeine samples.")         fatalError()       }               // Call the completion handler when done.       completionHandler()     }   }
0
0
881
Jun ’22
Have basic complications been deprecated in watchOS 9?
I have a simple complication-only app called Roughly, which shows the approximate time in words, to the nearest five minutes, in a choice of languages. It's been on the store for several years, and it's getting creaky. This new guide to WidgetKit is making me nervous: https://developer.apple.com/documentation/widgetkit/converting-a-clockkit-app There's a line buried in there: watchOS 9 and later no longer shows families like CLKComplicationFamily.circularSmall, CLKComplicationFamily.modularSmall, or CLKComplicationFamily.modularLarge on watch faces. So... is that the end of all basic complications that haven't been made into Widgets? If so, it would be good to have more clarity on this — I do feel it's easy to miss when things are deprecated. Thanks for any info!
2
0
1.9k
Jun ’22
Complication experiencing odd behaviour for only one user
I have one user that is getting some very odd behavior for one of my complications. The complication will work fine for a little bit, but then gets into a state where when the watch is asleep it is displaying correctly and then when the watch wakes up it's the default dashed out view with the app name. This is happening on a Watch Series 5 with cellular that is on the latest WatchOS (8.5). It was also happening on 8.4.2. All of the other complication types work perfectly fine on their watch. It is just this specific one, which other than the way the view is laid out is no different than the others under the hood. They all share the same data. The problem complication uses CLKComplicationTemplateGraphicRectangularFullView and the only thing I can think of is that maybe there is an issue with support on the Series 5. Though I have no evidence to support this theory since there isn't any helpful log messages. Testers on Series 6 and Series 7 report zero problems with this complication. I have added in a special view for when this complication fails for whatever reason, at least whatever reason I can capture and it is never displayed. It just shows the generic Apple dashed out view. So it seems something else is going wrong under the hood. Any and all help would be much appreciated.
1
0
1k
Mar ’22
WCSession isComplicationEnabled() always false w simulator?
In my iOS app, I check to see if there's an active complication before sending complication data to the watch, given the limit of 50 transfers per day. It seems isComplicationEnabled() always returns false in the simulator, even though I have a watch app in a watchOS simulator that's active and running, with complications that actively get updated from the watch code as well. Data is successfully being passed from the simulated iPhone to the simulated watch app - both are active, connected and otherwise in sync. When I run using a physical device, WCSession isComplicationEnabled() on my iPhone does return true, but it seems to always be false in the simulator. Is this a limitation? Bug? Anyone else seeing this?
3
1
2k
Mar ’22
Resetting CLKRelativeDateTextProvider
I have successfully created a complication in Large text for the modular face which creates a countdown timer. However, when the countdown gets to 0, it starts to count up. This is similar to a timer in storyboard where you need to stop the timer or it counts up. However, I can't find a method to stop the time from counting up in a complication. I have tried to use the getTimelineEntriesForComplication function to create a new template after the countdown finishes to show 00:00, however, it doesn't seem to work. Has anyone successfully created a countdown complication in which it stops at 0? If so, how did you complete that task.
0
0
596
Aug ’21
Does anyone implement getAlwaysOnTemplate in their App for Apple Watch Complications on the Always-On Display
I supported the Always-On display in my app complications from day one but since am continuing to find animation glitches and bugs that have never been fixed and exist currently on WatchOS 8 & 9 (I've tried Series 6 & 8 devices). I'm thinking about scrapping it and just returning the handler(nil). Does anyone have an example of where they use it and it really adds value to their app complications? And do they have any suggestions to try and work around the glitches? Thanks
Replies
0
Boosts
0
Views
1.5k
Activity
Jan ’23
watchOS 9.2 breaks the complicationForeground() modifier
I found that watchOS 9.2 seems to break the complicationForeground() modifier. In previous systems, a View modified by complicationForeground() was rendered white, while an unmodified View was rendered with the watch face tint color. This is the correct behavior. However, in watchOS 9.2, this behavior has been reversed. The View modified by complicationForeground() renders the tint color, and the opposite is white‽ This causes third-party complications to look very inconsistent on tinted watch faces. Of course, this issue belongs to ClockKit, and I'm not sure if there are similar issues in the new WidgetKit. Will this issue be fixed please?
Replies
4
Boosts
0
Views
1.9k
Activity
Dec ’22
Are old (CLKComplicationDataSource-based) complications still supported in new extensionless Watch targets?
Hello, I am migrating a watch app from older dual watch-app/watch-extension targets to a new extensionless target, but my complications seem to have lost the ability to update. I have set the CLKComplicationPrincipalClass key in Info.plist to my ComplicationController class (class ComplicationController: NSObject, CLKComplicationDataSource), but while the previews inside the complication picker show up correctly, the complications themselves stopped working on the watchface. Namely, they don't redraw anymore, when I refresh them like this: let complicationServer = CLKComplicationServer.sharedInstance() if let activeComplications = complicationServer.activeComplications { for complication in activeComplications { complicationServer.reloadTimeline(for: complication) } } Is there something I am missing? Some way of registering the CLKComplicationDataSource instance in SwiftUI watch app definition? Or is this not supported, and the only way forward is to rewrite all ClockKit complications to WidgetKit ones?
Replies
4
Boosts
0
Views
2.4k
Activity
Nov ’22
CLKComplicationDescriptor identifier for very old complications
I'm in the process of updating an app that uses complications that originally had a deployment target of watchOS 4.3. These complications used CLKComplicationSupportedFamilies defined in Info.plist. There are no CLKComplicationDescriptors in use. Updated complications that use a new CLKComplicationDescriptor.identifier display correctly in the complication picker, but the original complication that's using CLKDefaultComplicationIdentifier displays "--" or "---" depending on placement. This happens whether you are using a ComplicationController instance or WidgetKit. Using CLKDefaultComplicationIdentifier as the identifier when creating the CLKComplicationDescriptor doesn't work: the complication doesn't appear in the picker. My question is there a way to "upgrade" an older complication configured by the customer to a new complication identifier? I'm not using WidgetKit for this project so a widgetMigrator isn't an option. -ch
Replies
0
Boosts
0
Views
1.4k
Activity
Nov ’22
Can't add memoji watch face in Swift
My codes : CLKWatchFaceLibrary().addWatchFace(at: url) { (error) in print(error) } I can add other watch faces except Memoji watch face. The error is Error Domain=CLKWatchFaceLibraryErrorDomain Code=4 "IMPORT_FACE_ERROR_FACE_NOT_AVAILABLE" UserInfo={NSLocalizedDescription=IMPORT_FACE_ERROR_FACE_NOT_AVAILABLE}
Replies
2
Boosts
0
Views
2.2k
Activity
Oct ’22
Equivalent of CLKComplicationTemplateGraphicCornerStackText in WidgetKit?
Trying to create a corner complication with curved text for watchOS 9. The documentation has pointed me to the ClockKit class CLKComplicationTemplateGraphicCornerStackText, but this is marked as deprecated since we are supposed to be moving to WidgetKit for everything. What would be the way to get this kind of curved text going forward?
Replies
2
Boosts
1
Views
1.1k
Activity
Oct ’22
How to reset `WCSession.remainingComplicationUserInfoTransfers` during watchOS complication development or testing?
Is there a way to reset the complication communication threshold WCSession.remainingComplicationUserInfoTransfers during development or testing? I tried deleting the app and reinstalling and this threshold does not appear to reset. During development we get only 50 tries per day? After that pack up and go home?
Replies
5
Boosts
1
Views
1.9k
Activity
Oct ’22
Clock widget
Is there a way to make the clock widget not say cup? I get that it’s short for Cupertino but it’s really tacky and ugly. Would prefer it to say nothing but the time... androids clock widgets have multiple skins to and have had them for like 10 years but all you got is some ugly analog clock that says cup. Cmon guys...
Replies
5
Boosts
0
Views
16k
Activity
Oct ’22
CUP in clock
After having updated my iPhone (ios 15 -> 16) in the widget it shows CUP in the clock and it's so annoying. Also, I am not able to edit it and select the city for the clock widget.
Replies
1
Boosts
0
Views
3.3k
Activity
Sep ’22
clock_gettime can't get the exact CPU time of thread on Mac with m1 chip
I used clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts) to get the CPU time of the thread but found that the time fetched through it on M1 was very small. The iPhone and non-M1 devices are fine. double CPUTime() { struct timespec ts; int ret = clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts); return ts.tv_sec + ts.tv_nsec/1000.0/1000.0/1000.0; } double RealTime() { struct timespec ts; int ret = clock_gettime(CLOCK_MONOTONIC, &ts); return ts.tv_sec + ts.tv_nsec/1000.0/1000.0/1000.0; } void longTask() { double begin = RealTime(); double limit = 1.0; static double g_result = 0; while (1) { for (int i=0; i<1000000; i++) { g_result = sin(g_result+5); } double now = RealTime(); if (now - begin >= limit) break; } return; } void testClocks() { double t1, t0, cpuTimeCost, realTimeCost; t0 = CPUTime(); longTask(); t1 = CPUTime(); cpuTimeCost = t1 - t0; double t10 = RealTime(); longTask(); double t11 = RealTime(); realTimeCost = t11 - t10; NSLog(@"\nthread cpu: %lfs\nreal: %lfs", cpuTimeCost, realTimeCost); return; } the output is: thread cpu: 0.024395s real: 1.006627s By contrast, on iPhone or Mac with an Intel chip, these two values are almost the same. Any help here? I've tried the Rosetta model and it's the same problem.
Replies
1
Boosts
0
Views
1.2k
Activity
Aug ’22
How to support VoiceOver on Apple Watch complication
Anyone dealt before with Apple Watch complications accessibility? I'm using CLKComplicationTemplateGraphicCornerGaugeText to display custom data but VoiceOver adds degrees (º) after saying the value. I've tried with accessibilityLabel on CLKTextProvider but doesn't fix it. Any idea? Thanks in advance!
Replies
1
Boosts
1
Views
1.8k
Activity
Aug ’22
apple watch clockkit on background is not working even on sample code
https://developer.apple.com/documentation/clockkit/creating_and_updating_a_complication_s_timeline I just run sample app to check background delivery on health kit. I added caffein on my health app on phone. but it dosen't triggered on obeserver processUpdate function. func processUpdate(query: HKObserverQuery,             completionHandler: @escaping () -> Void,             error: Error?) {     print("processUpdate come!!!!")     logger.debug("Received an update from the background observer query.")           // Check for any errors that occur while setting up the observer query.     guard error == nil else {       logger.error("Unable to set up a background observer query: \(error!.localizedDescription)")       fatalError()     }           logger.debug("Responding to a background query.")           Task {               // Load the updated data from the HealthKit Store.       let success = await loadNewDataFromHealthKit()               // Check for any errors.       guard success == true else {         logger.error("Unable to query for new or deleted caffeine samples.")         fatalError()       }               // Call the completion handler when done.       completionHandler()     }   }
Replies
0
Boosts
0
Views
881
Activity
Jun ’22
Have basic complications been deprecated in watchOS 9?
I have a simple complication-only app called Roughly, which shows the approximate time in words, to the nearest five minutes, in a choice of languages. It's been on the store for several years, and it's getting creaky. This new guide to WidgetKit is making me nervous: https://developer.apple.com/documentation/widgetkit/converting-a-clockkit-app There's a line buried in there: watchOS 9 and later no longer shows families like CLKComplicationFamily.circularSmall, CLKComplicationFamily.modularSmall, or CLKComplicationFamily.modularLarge on watch faces. So... is that the end of all basic complications that haven't been made into Widgets? If so, it would be good to have more clarity on this — I do feel it's easy to miss when things are deprecated. Thanks for any info!
Replies
2
Boosts
0
Views
1.9k
Activity
Jun ’22
Complication experiencing odd behaviour for only one user
I have one user that is getting some very odd behavior for one of my complications. The complication will work fine for a little bit, but then gets into a state where when the watch is asleep it is displaying correctly and then when the watch wakes up it's the default dashed out view with the app name. This is happening on a Watch Series 5 with cellular that is on the latest WatchOS (8.5). It was also happening on 8.4.2. All of the other complication types work perfectly fine on their watch. It is just this specific one, which other than the way the view is laid out is no different than the others under the hood. They all share the same data. The problem complication uses CLKComplicationTemplateGraphicRectangularFullView and the only thing I can think of is that maybe there is an issue with support on the Series 5. Though I have no evidence to support this theory since there isn't any helpful log messages. Testers on Series 6 and Series 7 report zero problems with this complication. I have added in a special view for when this complication fails for whatever reason, at least whatever reason I can capture and it is never displayed. It just shows the generic Apple dashed out view. So it seems something else is going wrong under the hood. Any and all help would be much appreciated.
Replies
1
Boosts
0
Views
1k
Activity
Mar ’22
WCSession isComplicationEnabled() always false w simulator?
In my iOS app, I check to see if there's an active complication before sending complication data to the watch, given the limit of 50 transfers per day. It seems isComplicationEnabled() always returns false in the simulator, even though I have a watch app in a watchOS simulator that's active and running, with complications that actively get updated from the watch code as well. Data is successfully being passed from the simulated iPhone to the simulated watch app - both are active, connected and otherwise in sync. When I run using a physical device, WCSession isComplicationEnabled() on my iPhone does return true, but it seems to always be false in the simulator. Is this a limitation? Bug? Anyone else seeing this?
Replies
3
Boosts
1
Views
2k
Activity
Mar ’22
Resetting CLKRelativeDateTextProvider
I have successfully created a complication in Large text for the modular face which creates a countdown timer. However, when the countdown gets to 0, it starts to count up. This is similar to a timer in storyboard where you need to stop the timer or it counts up. However, I can't find a method to stop the time from counting up in a complication. I have tried to use the getTimelineEntriesForComplication function to create a new template after the countdown finishes to show 00:00, however, it doesn't seem to work. Has anyone successfully created a countdown complication in which it stops at 0? If so, how did you complete that task.
Replies
0
Boosts
0
Views
596
Activity
Aug ’21