Questions tagged [wkrefreshbackgroundtask]

13 questions
9
votes
2 answers

WKURLSessionRefreshBackgroundTask isn't called when attempting to do background refreshes in watchOS

I'm working on a complication to get scheduled data from a web service. Every 20-30 minutes (or manually), I am scheduling a WKRefreshBackgroundTask to do this. As suggested by Apple, I want the OS to handle the fetching of this data via a…
9
votes
1 answer

Updating complication with Swift 3 and background task

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…
4
votes
1 answer

reloadTimeline() doesn't update complication

I'm trying to make a watchOS 3 app, and I want to update my complication in a background task. First, I get new data from a server in a background task within handle(). After that, I update my active complications by calling…
2
votes
1 answer

WKRefreshBackgroundTask for CloudKit on watchOS?

So, on watchOS, I know you can schedule (and reschedule) a WKRefreshBackgroundTask to do work for you in the background. This is great for my app to make sure that data is current and up-to-date on watchOS - especially since it doesn't receive…
Mario A Guzman
  • 3,483
  • 4
  • 27
  • 36
2
votes
1 answer

watchOS background task crashes on setTaskCompleted

In my watch extension delegate init function, I set up KVO observers on the WCSession: if WCSession.isSupported() { let defaultSession = WCSession.default defaultSession.addObserver(self, forKeyPath: "activationState", …
Reinhard Männer
  • 14,022
  • 5
  • 54
  • 116
2
votes
1 answer

When WKExtension.scheduleBackgroundRefresh is supposed to call scheduledCompletion handler?

I'm trying to schedule background task with such line: WKExtension.shared().scheduleBackgroundRefresh(withPreferredDate: Date(timeIntervalSinceNow: TimeInterval(5) * 60), userInfo: nil, scheduledCompletion: self.scheduledCompletion) where func…
abjurato
  • 1,439
  • 11
  • 17
2
votes
2 answers

To add the WatchOS 3 snapshot feature, handleBackgroundTasks and scheduleSnapshotRefreshWithPreferredDate are never triggered

I need to add the snapshot of a watch app to be placed in Dock as it's a new feature I can't find any resources to guide me. I have read Apple's Documentation…
1
vote
0 answers

WatchOS app got crashed by showing detail [WKRefreshBackgroundTask dealloc]

I know this crash is related to updating complication in background and system automatically release the object may be due to suspend state. So here is detail what I am trying to do in watchOS app. I am updating complication content in background.…
1
vote
2 answers

WKRefreshBackgroundTask doesn't working

I'm trying to do my watch app running in the background mode. For starting doing this, I copied the example from this apple…
1
vote
1 answer

WatchOS 3 WKApplicationRefreshBackgroundTask didReceiveChallenge

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:…
CodenameDuchess
  • 1,221
  • 18
  • 24
1
vote
0 answers

watchOS 3 app gets seemingly randomly killed in Background

I upgraded my watchOS app to support the new watchOS 3 background modes. Most of the time that works totally fine. But more often that I like it gets killed by watchOS with a report like the following: Incident Identifier: XXX CrashReporter Key: …
0
votes
0 answers

Background URL session upload task behavior in watchOS?

I’m working on an independent watchOS app which is primarily designed to to collect and periodically send location updates to a server. The UI features a toggle that allows the user to turn this capability on or off at their discretion. The typical…
bmt22033
  • 6,880
  • 14
  • 69
  • 98
0
votes
1 answer

Using the existing glance screen of WatchOS 2 as snapshot of the watch app for WatchOS 3

I have an Apple WatchOS2 app which I need to upgrade it to WatchOS 3. As there is no glance screen on WatchOS 3 anymore I'm not sure how to use the current glance screen to create automatic snapshot by calling scheduleSnapshotRefresh method in…
Samira
  • 215
  • 2
  • 14