watchos-3

WatchOS 3 WKApplicationRefreshBackgroundTask didReceiveChallenge

久未见 提交于 2019-12-21 06:28:40
问题 I have finally (ignoring the sample code which I never saw work past "application task received, start URL session") managed to get my WatchOS3 code to start a background URL Session task as follows: func handle(_ backgroundTasks: Set<WKRefreshBackgroundTask>) { for task in backgroundTasks { if let refreshTask = task as? WKApplicationRefreshBackgroundTask { // this task is completed below, our app will then suspend while the download session runs print("application task received, start URL

WKWatchConnectivityRefreshBackgroundTask example

社会主义新天地 提交于 2019-12-13 07:05:23
问题 I want to pass data from my iOS App to my watchOS 3 app using WKWatchConnectivityRefreshBackgroundTask How do I set up code in my watchOS App to handle the data being transferred? For example in the past I used this iOS code to send a message from the iOS App and if there was no connection send a context: func sendTable() { let tableInfo: WatchWorkout = PhoneData().buildWatchTableData(Foundation.Date().refDays()) let archivedTable: Data = NSKeyedArchiver.archivedData(withRootObject: tableInfo

watchOS - Complication shows previous entry

半腔热情 提交于 2019-12-13 02:13:12
问题 I'm creating a watchOS 3 complication that shows departure times from a public transit service. I've created a data model with an array that contains Train objects with a stationName (String) and departureTime (NSDate). I've implemented the getCurrentTimelineEntry() method and the entries are showing on the watch. The problem is that the watch shows only the previous entry. For example, I've the following departure times: Train(startStation: "Station name", endStation: "Station name",