Using the Batch Sync Up Target

To enhance performance in large sync up operations, Mobile SDK 7.1 introduces a batch sync up target.

iOS Native 

Swift

1BatchSyncUpTarget

Objective-C

1SFBatchSyncUpTarget

Android Native 

1BatchSyncUpTarget

This target enhances the standard sync up target behavior by calling the Salesforce composite API. The composite API sends local records to the server in batches of up to 25 records.

iOS Native 

Swift

1var target = BatchSyncUpTarget.init(createFieldList, updateFieldList)
2let syncMgr = SyncManager.sharedInstance(store: self.store!)
3syncMgr!.syncUp(target: target, options: options, soupName: soupName) {...}

Objective-C

1SFBatchSyncUpTarget* target = [[SFBatchSyncUpTarget alloc] init];
2// or
3SFBatchSyncUpTarget* target =
4    [[SFBatchSyncUpTarget alloc] initWithCreateFieldlist:createList
5                                            updateFieldlist:updateList];
6[syncManager syncUpWithTarget:target
7                      options:options
8                     soupName:soupName
9                  updateBlock:updateBlock];

Android Native 

1BatchSyncUpTarget target = new BatchSyncUpTarget();
2// or
3BatchSyncUpTarget target = new BatchSyncUpTarget(createFieldlist, updateFieldlist);
4syncManager.syncUp(target, options, soupName, callback);

Hybrid and React Native 

Existing sync up targets in hybrid and React Native apps automatically use the batch sync up target. To use a different sync up target implementation such as the legacy SyncUpTarget class, specify “androidImpl” or “iOSImpl”.

Usage in Sync Config Files 

By default, sync up targets defined in sync config files use batch APIs. For example, the following sync configuration creates a batch sync up target.

1{
2  "syncs": [
3    {
4      "syncName": "syncUpContacts",
5      "syncType": "syncUp",
6      "soupName": "contacts",
7      "target": {
8        "createFieldlist": [
9          "FirstName",
10          "LastName",
11          "Title",
12          "MobilePhone",
13          "Email",
14          "Department",
15          "HomePhone"
16        ]
17      },
18      "options": {
19        "fieldlist": [
20          "Id",
21          "FirstName",
22          "LastName",
23          "Title",
24          "MobilePhone",
25          "Email",
26          "Department",
27          "HomePhone"
28        ],
29        "mergeMode": "LEAVE_IF_CHANGED"
30      }
31    }
32  ]
33}

See Also 

We've Moved

Welcome to the new home of the Mobile SDK Developer Guide! For now, the Japanese guide can be found in PDF form.