The best way to sync data, especially if your data is updating weekly, would be to use the Background Tasks Framework. This would allow you to loosely schedule a repeating task which you can use to sync your data.
The sample project Refreshing and Maintaining Your App Using Background Tasks shows how to use scheduled background tasks for refreshing your app content.
The two caveats with this are:
1- you cannot set a specific date/time for the task. It will run whenever the system considers is appropriate.
2- it will not work if the app is swiped away (which is true for most methods that will execute in the background) until the user relaunches the app themselves.
If you are using push notifications, I presume you are using content-available:1
in your payload, and is likely silent pushes. While these kinds of pushes are designed exactly for your purpose of refreshing data, they are not guaranteed to execute your app every single time. These are heavily throttled, and will execute your app only when the system thinks is appropriate (based on device state, and many factors). While you can expect 1-2 content pushes to reach your app per hour, none may, depending on these many factors. Also, if the user swipes away the app, then these notifications will never reach your app until it is relaunched by the user again.
If, for some reason, it is important to process the updated data ASAP upon change and on demand, one other option you have is to use a [Notification Service Extension]
(https://developer.apple.com/documentation/usernotifications/unnotificationserviceextension.)
The Notification Service Extension will be executed for every visible push notification. So, it could serve your needs, as long as the user has not disabled the visibility of your notifications through various settings, and your users won't be annoyed by seeing these notifications.
The service extension will not be executed for push notifications that will not be presented visually. So, if you chose to go down this route, you will need to find a way to make these notifications not disturbing as much as you can.
Argun Tekant /
DTS Engineer /
Core Technologies