Using the Refresh Sync Down Target
Many apps download records, cache all of them, and then let users edit them from the SmartStore cache when connectivity drops. Local “offline” work is quick and efficient—a great user experience—but, when connectivity resumes, it's important to refresh the cached records with server updates.
To maximize performance and efficiency, Mobile SDK provides a refresh sync down target. The refresh target supports a single call that doesn't require preparatory coding. You create an instance of the target with a soup name, an object type, and a list of fields. You then pass the target instance to a sync down method. The refresh target gathers IDs of the pertinent soup records, queries the server for the current field values, and then refreshes the soup.
The refresh sync down target is available on iOS and Android for native, React native, and hybrid apps.
iOS
Class:
Swift | Objective-C |
---|---|
RefreshSyncDownTarget | SFRefreshSyncDownTarget |
- Swift
Here's an example:
- Objective-C
Android
Class:
Constructor:
JavaScript (Hybrid, React Native)
Function: