Is transferCurrentComplicationUserInfo more suitable for complication update?

What is the difference between transferCurrentComplicationUserInfo and transferUserInfo?

I want to send data from my AppDelegate to a clock kit complication.

transferCurrentComplicationUserInfo seems to do exactly the same thing as transferCurrentUserInfo. Am I missing something?


Solution 1:

The distinction between these two WCSession methods involve when the data is sent, and whether the watchkit extension is woken up or not.

transferCurrentComplicationUserInfo: is specifically designed for transferring complication user info meant to be shown on the watch face right now.

  • The complication user info is marked "Urgent", and is placed at the front of the queue,
  • the watch wakes the extension in the background to receive the info, and
  • the transfer happens immediately. (Other queued information might also transfer at that point.)

transferUserInfo: queues up information, to be transferred when the system determines it's a good time to process the queue:

  • The user info is placed at the back of the queue,
  • the transferred information is stored if the extension is not awake,
  • the transfer does not happen immediately, and
  • the information is delivered in the order in which they were sent.

More details can be found in the WWDC 2015 Introducing Watch Connectivity video.

Update for iOS 10:

In iOS 10, WCSession adds a remainingComplicationUserInfoTransfers property which can affect which method that iOS will use to transfer the user info:

The number of remaining times that you can call transferCurrentComplicationUserInfo: during the current day. If this property is set to 0, any additional calls to transferCurrentComplicationUserInfo: use transferUserInfo: instead.

If the complication is on the active watch face, you are given 50 transfers a day. If the complication is not active, this property defaults to 0.

Solution 2:

To my knowledge: TransferCurrentComplicationUserInfo has the same functionality as transferCurrentUserInfo when called form the parent app app delegate, however, the TransferCurrentComplicationUserInfo also calls CLKServer......etc to update the complication. I have to say I find both unreliable and I'm struggling with TransferCurrentComplicationUserInfo to update my app. Doesn't always seem to work. The annoying thing is that it varies between build without changing the code which technically shouldn't be possible. oh well...