watchkitapple-watchapple-watch-complicationclockkitwcsession

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

  • 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.

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

    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.