Background Icon Icon Update on iOS7

I have an application that I want to update the icon of the icon weekly. I see that, at least until iOS7, UILocalNotification can only set the icon of the icon to a specific number, for example

someLocalNotification.applicationIconBadgeNumber = 42;

But I want my application to load in the background, you can say every Sunday, make a calculation based on how to get the difference between the current date and some start date and update the icon number accordingly.

UILocalNotification cannot do this, apparently. This is like push notifications, but I don’t have a server component for this application, so using this as a workaround will not work, and I'm not sure if Apple will like it anyway.

I know that in iOS7 there are background updates to update the background, but I'm not sure that they will work in this situation.

TL; DR: How to update the icon icon in iOS7, which requires a small amount of computation to get the right number on a weekly basis (or any arbitrarily lengthy basis)? And I want to do this background update without a server component.

+4
source share
1 answer

You simply schedule a quiet local notification with a nil message, and then update the icon number. Also set the number of repeats to zero, otherwise the icon will not be updated if you call this local notification several times

,

0

Source: https://habr.com/ru/post/1526655/


All Articles