Budgets/schedules for complication update

1. in the complication controller,

when use

requestedUpdateDidBegin/getNextRequestedUpdateDateWithHandler

to schedule the update, what's the max frequency that we can update so that it will not fall into budget exhausted?

2.

when using the getNextRequestedUpdateDateWithHandler, it seems the next update time is not exactly the same as what I expected,

it is a little non-determite.

3.

if I use transferComplicationUserInfo in the iPhone to update the complication, is there a budget for that?

Thanks

Replies

So, i have a bit of experience with some of this I think :


1. Say you had a complication that simply showed the time of update (in other words as little processing as possible) you can call an update every 5 mins and the budget never seems to exhaust, however, it does not necessarily update every 5 mins (see 2.)


2. I find that if you call getNextRequestesUpdateDateWithHandler as a date under 30 mins time, it tends to be very variable and generally about double the amount of time you ask for. Other more 'professional' developers around here will probably say 'the system is choosing the optimum time' but personally I think that's bollocks.


3. There is a budget for transferComplicationUserInfo but I've never reached it. As long as you've done the processing on the phone and just passed it on, you should be fine to call it at least 3 times an hour


Good luck, I certainly haven't had any yet with complications!

Have to agree, as to 2)


In my testing, you can set very short time periods, but the shortest update rate will be 10 minutes. I think Apple is actually doing an internal wakeup of some kind at each 10 minutes after the hour, as a test I ran would wake up at :10, :20, :30, etc pretty consistently. Sometimes it would delay a little, but then it would go back to being on the 10's.


Although, there seem to be periods when it just stops for a while. I think this relates to how much work you are doing, but I haven't been able to tell why that happens.


I don't have any evidence that 'the system is choosing the optimum time'... 😉

when you say, "little processing as possible",

if in requestedUpdateDidBegin, I start anyother thread to do my job, like this:

func requestedUpdateDidBegin {

dispatch_async(***, ...) {

// do a lot of job

}

}


the requestedUpdateDidBegin will return very fast, is it little processing?

and when will the job I started in another thread will suspend?

Thanks

It depends, As long as the code is synchronous so that once the requestUpdateDidBegin code has run, it has finished, you will be fine. If you do something like an HKSampleQuery which is Asynchronous, the return will be after the requestUpdateDidBegin function has finished and so may get suspended before finishing.