Watch Complications

RSS for tag

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

Posts under Watch Complications tag

165 Posts

Post

Replies

Boosts

Views

Activity

handle never invoked with WKURLSessionRefreshBackgroundTask type
Hi Folks, I am building a SwiftUI based WatchOS app primarily focused on updating a complication using data from a REST API call. I am trying to reproduce the approach to updating complications in the background as described in "Keeping your complications up to date". The trouble I have is that the func handle(_ backgroundTasks: Set<WKRefreshBackgroundTask>) method on the ExtensionDelegate is never called for the WKURLSessionRefreshBackgroundTask task type. The handle method is invoked for other task types such as WKSnapshotRefreshBackgroundTask. After some refactoring, I have deviated from the approach in the video and I now reshedule the background task in the func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?) method of the URLSessionDownloadDelegate. This works fine, and the tasks are being resheduled in the background, but my concern is that there maybe a WKURLSessionRefreshBackgroundTask object lurking in the background for which I haven't called setTaskCompletedWithSnapshot. My session is configured as follows: private lazy var backgroundURLSession: URLSession = { let appBundleName = Bundle.main.bundleURL.lastPathComponent.lowercased().replacingOccurrences(of: " ", with: ".") let sessionIdentifier = "com.gjam.liffeywatch.\(appBundleName)" let config = URLSessionConfiguration .background(withIdentifier: sessionIdentifier) config.isDiscretionary = false config.sessionSendsLaunchEvents = true config.requestCachePolicy = .reloadIgnoringLocalCacheData config.urlCache = nil return URLSession (configuration: config, delegate: self , delegateQueue: nil ) }() and the scheduling code is a follows: func schedule(_ first: Bool) { print("Scheduling background URL session") let bgTask = backgroundURLSession.downloadTask(with: LiffyDataProvider.url) #if DEBUG bgTask.earliestBeginDate = Date().addingTimeInterval(first ? 10 : 60 * 2) #else bgTask.earliestBeginDate = Date().addingTimeInterval(first ? 30 : 60 * 60 * 2) #endif bgTask.countOfBytesClientExpectsToSend = 200 bgTask.countOfBytesClientExpectsToReceive = 1024 bgTask.resume() print("Task started") backgroundTask = bgTask } Does anyone have any idea's why the handle method is not invoked with WKURLSessionRefreshBackgroundTask tasks? Cheers, Gareth.
2
0
1.3k
Jan ’22
SF Symbol using string interpolation
I was very happy when I saw this: "You can embed a symbol inside a run of text by using string interpolation." Text("Thalia… \(Image(systemName: "chevron.forward"))") Unfortunately this is a feature of SwiftUI and not generally available string interpolation. In places where a string is expected like an Apple Watch Compilcation Text Provider CLKSimpleTextProvider(text: "\(Image(systemName: "heart"))") this doesn't return an inline Image but "Image(provider: SwiftUI.ImageProviderBox<SwiftUI.Image.(unknown context at $18487da20).NamedImageProvider>)" So… Is there a way to include an SF Symbol in a regular string to wiggle it into a CLKSimpleTextProvider?
2
0
3.2k
Dec ’21
How to enable and collect application log for apple watch?
Hi there, I am looking for a way to collect application logging for apple watch. So far, I only found this https://download.developer.apple.com/iOS/watchOS_Logs/sysdiagnose_Logging_Instructions.pdf to collect sysdiagnose logging. I looked into the sysdiagnose logging and it doesn't seem to be the application log. I am looking for sth like the log in xcode debug console. Do you know how I can collect this log?
1
0
873
Oct ’21
handle never invoked with WKURLSessionRefreshBackgroundTask type
Hi Folks, I am building a SwiftUI based WatchOS app primarily focused on updating a complication using data from a REST API call. I am trying to reproduce the approach to updating complications in the background as described in "Keeping your complications up to date". The trouble I have is that the func handle(_ backgroundTasks: Set<WKRefreshBackgroundTask>) method on the ExtensionDelegate is never called for the WKURLSessionRefreshBackgroundTask task type. The handle method is invoked for other task types such as WKSnapshotRefreshBackgroundTask. After some refactoring, I have deviated from the approach in the video and I now reshedule the background task in the func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?) method of the URLSessionDownloadDelegate. This works fine, and the tasks are being resheduled in the background, but my concern is that there maybe a WKURLSessionRefreshBackgroundTask object lurking in the background for which I haven't called setTaskCompletedWithSnapshot. My session is configured as follows: private lazy var backgroundURLSession: URLSession = { let appBundleName = Bundle.main.bundleURL.lastPathComponent.lowercased().replacingOccurrences(of: " ", with: ".") let sessionIdentifier = "com.gjam.liffeywatch.\(appBundleName)" let config = URLSessionConfiguration .background(withIdentifier: sessionIdentifier) config.isDiscretionary = false config.sessionSendsLaunchEvents = true config.requestCachePolicy = .reloadIgnoringLocalCacheData config.urlCache = nil return URLSession (configuration: config, delegate: self , delegateQueue: nil ) }() and the scheduling code is a follows: func schedule(_ first: Bool) { print("Scheduling background URL session") let bgTask = backgroundURLSession.downloadTask(with: LiffyDataProvider.url) #if DEBUG bgTask.earliestBeginDate = Date().addingTimeInterval(first ? 10 : 60 * 2) #else bgTask.earliestBeginDate = Date().addingTimeInterval(first ? 30 : 60 * 60 * 2) #endif bgTask.countOfBytesClientExpectsToSend = 200 bgTask.countOfBytesClientExpectsToReceive = 1024 bgTask.resume() print("Task started") backgroundTask = bgTask } Does anyone have any idea's why the handle method is not invoked with WKURLSessionRefreshBackgroundTask tasks? Cheers, Gareth.
Replies
2
Boosts
0
Views
1.3k
Activity
Jan ’22
SF Symbol using string interpolation
I was very happy when I saw this: "You can embed a symbol inside a run of text by using string interpolation." Text("Thalia… \(Image(systemName: "chevron.forward"))") Unfortunately this is a feature of SwiftUI and not generally available string interpolation. In places where a string is expected like an Apple Watch Compilcation Text Provider CLKSimpleTextProvider(text: "\(Image(systemName: "heart"))") this doesn't return an inline Image but "Image(provider: SwiftUI.ImageProviderBox<SwiftUI.Image.(unknown context at $18487da20).NamedImageProvider>)" So… Is there a way to include an SF Symbol in a regular string to wiggle it into a CLKSimpleTextProvider?
Replies
2
Boosts
0
Views
3.2k
Activity
Dec ’21
Apple Watch Update Request
I get a notification on my phone approximately 4 times a day asking me to update my Apple Watch. I don’t have an Apple Watch and can’t find any connected my account in my settings profile. Any ideas to stop this as it’s incredibly frustrating!!
Replies
0
Boosts
0
Views
506
Activity
Nov ’21
Apple: please update documentation for 41mm and 45mm Series 7 watches
Need complication sizes: Example: https://developer.apple.com/design/human-interface-guidelines/watchos/overview/complications/ https://developer.apple.com/documentation/clockkit/clkcomplicationtemplategraphiccircularimage FB9632184 filed
Replies
3
Boosts
0
Views
1.5k
Activity
Oct ’21
How to enable and collect application log for apple watch?
Hi there, I am looking for a way to collect application logging for apple watch. So far, I only found this https://download.developer.apple.com/iOS/watchOS_Logs/sysdiagnose_Logging_Instructions.pdf to collect sysdiagnose logging. I looked into the sysdiagnose logging and it doesn't seem to be the application log. I am looking for sth like the log in xcode debug console. Do you know how I can collect this log?
Replies
1
Boosts
0
Views
873
Activity
Oct ’21