apple-watch-complication

Keeping my WatchKit complications up to date when not running

随声附和 提交于 2019-12-06 08:02:58
问题 I'm working on the WatchKit Extension of my app, and have some issues with complications. I have a complication that displays a given total amount, which depends of what the user is doing on the iOS app. When the WatchKit Extension is running, the iOS app updates the watch app context using the -[WCSession updateApplicationContext:] method. It works fine, and then in the ExtensionDelegate of my Watch app, I manually update the complication with the new data. But this is OK only when the

Keeping my WatchKit complications up to date when not running

删除回忆录丶 提交于 2019-12-04 13:45:47
I'm working on the WatchKit Extension of my app, and have some issues with complications. I have a complication that displays a given total amount, which depends of what the user is doing on the iOS app. When the WatchKit Extension is running, the iOS app updates the watch app context using the -[WCSession updateApplicationContext:] method. It works fine, and then in the ExtensionDelegate of my Watch app, I manually update the complication with the new data. But this is OK only when the extension is running (if it's not, it won't get the application context until the next launch). So I edited

Watch Complication causes crash with dyld: Symbol not found: _OBJC_CLASS_$_CLKFullColorImageProvider

我的未来我决定 提交于 2019-12-04 05:20:01
问题 I'm getting this error dyld: Symbol not found: _OBJC_CLASS_$_CLKFullColorImageProvider in watchOS 4 but not in watchOS 5, I believe it's related to my complication code below but can't figure out why...as far as I can tell the compiler shouldn't be looking for CLKFullColorImageProvider as I've blocked that off with if #available(watchOSApplicationExtension 5.0, *) class Complication: NSObject, CLKComplicationDataSource { func getCurrentTimelineEntry(for complication: CLKComplication,

Updating complication with Swift 3 and background task

别等时光非礼了梦想. 提交于 2019-12-04 03:56:06
For watchOS 3, Apple suggests updating the complication with WKRefreshBackgroundTask instead of using getNextRequestedUpdateDate . How can I determine the time between two updates using the new approach? I would only hack my data requesting (from an url) into getCurrentTimelineEntry and would update the complication, but I think that's not really what Apple would recommend. A short code example would be a big help. I generally covered this in a different answer , but I'll address your specific question here. You're right that you shouldn't hack the complication controller to do any

watchOS - Show realtime departure data on complication

醉酒当歌 提交于 2019-12-03 21:23:46
问题 I have an public transport app with realtime departure data for trains. I would like to add a complication that shows the departure time of the next train. Is it possible to show (or refresh) realtime data on a complication? For example, showing "3 min. to station X." The data could change every minute, based on info that comes from the public transport API. How should I accomplish this on watchOS 2 or watchOS 3? I know the ETA app shows travel times in a complication, but I'm not sure how

How to correctly implement transfer of settings from iOS app to watchOS2 complication

风流意气都作罢 提交于 2019-12-02 09:26:58
问题 What I want to achieve is the following: Complication(s) get updated in the background at intervals of 30 minutes Complication(s) get updated whenever the watch app runs and receives its own updated data Complication(s) get updated whenever the iOS app runs and the user changes a setting which affects the watch data (such as changing location of weather observations, or display units) Items 1. and 2. seem to be straightforward, and nicely addressed here: What is the flow for updating

WatchKit 2 Complication Text Only Shows Up in Preview

旧时模样 提交于 2019-12-02 07:18:56
问题 I'm trying to develop a very simple complication for watchkit2 that says "Hi" from a simple text provider. I've managed to achieve some strange behavior; I can see the text when the complication is clicked or when you are previewing it from the customize watchface screen, but not when the watchface is displayed. Have a look: Any ideas what might be causing this? My text provider looks like this var textProvider: CLKSimpleTextProvider override init() { textProvider = CLKSimpleTextProvider()

How to correctly implement transfer of settings from iOS app to watchOS2 complication

和自甴很熟 提交于 2019-12-02 04:14:58
What I want to achieve is the following: Complication(s) get updated in the background at intervals of 30 minutes Complication(s) get updated whenever the watch app runs and receives its own updated data Complication(s) get updated whenever the iOS app runs and the user changes a setting which affects the watch data (such as changing location of weather observations, or display units) Items 1. and 2. seem to be straightforward, and nicely addressed here: What is the flow for updating complication data for Apple Watch? However, for item 3, in the iOS app, I set up a WCSession instance and call

WatchKit 2 Complication Text Only Shows Up in Preview

試著忘記壹切 提交于 2019-12-02 03:14:35
I'm trying to develop a very simple complication for watchkit 2 that says "Hi" from a simple text provider. I've managed to achieve some strange behavior; I can see the text when the complication is clicked or when you are previewing it from the customize watchface screen, but not when the watchface is displayed. Have a look: Any ideas what might be causing this? My text provider looks like this var textProvider: CLKSimpleTextProvider override init() { textProvider = CLKSimpleTextProvider() textProvider.text = "Hi" textProvider.shortText = "HI" textProvider.tintColor = UIColor.whiteColor()

watchOS - Show realtime departure data on complication

拈花ヽ惹草 提交于 2019-11-30 22:37:49
I have an public transport app with realtime departure data for trains. I would like to add a complication that shows the departure time of the next train. Is it possible to show (or refresh) realtime data on a complication? For example, showing "3 min. to station X." The data could change every minute, based on info that comes from the public transport API. How should I accomplish this on watchOS 2 or watchOS 3? I know the ETA app shows travel times in a complication, but I'm not sure how they achieve that. Are realtime updates possible? Complications aren't designed to show realtime data.