We develop a shared grocery shopping list for iOS, iPadOS and also watchOS. Users can share shopping lists between each other and the lists get automatically synced.
The user can go shopping using our watchOS app alone, as it is an independent watch app. While shopping, connectivity issues are very common, since in retail stores a reliable internet connection is very rare. This leads to the problem that sometimes changes to the shopping list won’t get synced back to our servers.
At some point after the shopping is done, we need to the sync local changes done to the shopping list back to the server. Since the app will most likely be in the background again as the user leaves the retail store, this sync needs to happen in the background (when we have a stable internet connection again). The API for this sync is a simple PUT request with a json body to send.
What frameworks / APIs should we use for this?
Firstly I wanted to use WKURLSessionRefreshBackgroundTasks. But according to this lasts year session at 09: 32 from WWDC20, no networking is allowed for this. Although, if I debug the app, the call completes. So I am confused right now. Can we perform a simple PUT request in the WKExtensionDelegate handle(:Set<WKRefreshBackgroundTask>)?
Also a lot of documentation is pointing me to use BackgroundURLSessions for doing networking in the background (also this session here from WWDC21). But BackgroundURLSessions only support download- or upload tasks. Simple dataTasks are not supported in background sessions (see here). So this is no option either...
What should I do here?
Thank you
Post
Replies
Boosts
Views
Activity
In the session "Keep you complication up to date" (https://developer.apple.com/videos/play/wwdc2020/10049/), they explain how to create a proper certificate for your complication pushes (at min 16:55)
They explain that you would have to create an app identifier with your bundle identifier and ending in watchkitapp.complication (example: bundleId.watchkitapp.complication).
If I want to create such an app identifier, I get the following error on the developer portal ({bundleId} is a placeholder for the actual bundle id):
An attribute in the provided entity has invalid value
An App ID with Identifier '{bundleId}.watchkitapp.complication' is not available. Please enter a different string.
Does anyone experience the same? How to fix this?