SFSyncTarget Class Reference

Inherits from NSObject
Declared in SFSyncTarget.h

Other Methods

  idFieldName

The field name of the ID field of the record. Defaults to “Id”.

@property (nonatomic, copy) NSString *idFieldName

Declared In

SFSyncTarget.h

  modificationDateFieldName

The field name of the modification date field of the record. Defaults to “LastModifiedDate”.

@property (nonatomic, copy) NSString *modificationDateFieldName

Declared In

SFSyncTarget.h

– initWithDict:

Designated initializer that initializes a sync target from the given dictionary.

- (instancetype)initWithDict:(NSDictionary *)dict

Parameters

dict

The sync target serialized to an NSDictionary.

Declared In

SFSyncTarget.h

– asDict

The target represented as a dictionary. Note: inheriting classes should initialize their dictionary from the super representation, as each parent class can add fields to the dictionary along the way.

- (NSMutableDictionary *)asDict

Return Value

The target represented as a dictionary.

Declared In

SFSyncTarget.h

– cleanAndSaveInLocalStore:soupName:record:

Save record in local store (marked as clean)

- (void)cleanAndSaveInLocalStore:(SFMobileSyncSyncManager *)syncManager soupName:(NSString *)soupName record:(NSDictionary *)record

Parameters

syncManager

The sync manager

soupName

The soup

record

The record

Declared In

SFSyncTarget.h

– cleanAndSaveRecordsToLocalStore:soupName:records:syncId:

Save records in local store (marked as clean)

- (void)cleanAndSaveRecordsToLocalStore:(SFMobileSyncSyncManager *)syncManager soupName:(NSString *)soupName records:(NSArray *)records syncId:(NSNumber *)syncId

Parameters

syncManager

The sync manager

soupName

The soup

records

The records to save

syncId

The sync id

Declared In

SFSyncTarget.h

– isLocallyCreated:

The record

- (BOOL)isLocallyCreated:(NSDictionary *)record

Parameters

record

The record

Return Value

YES if record was locally created

Declared In

SFSyncTarget.h

– isLocallyUpdated:

The record

- (BOOL)isLocallyUpdated:(NSDictionary *)record

Parameters

record

The record

Return Value

YES if record was locally updated

Declared In

SFSyncTarget.h

– isLocallyDeleted:

The record

- (BOOL)isLocallyDeleted:(NSDictionary *)record

Parameters

record

The record

Return Value

YES if record was locally deleted

Declared In

SFSyncTarget.h

– isDirty:

The record

- (BOOL)isDirty:(NSDictionary *)record

Parameters

record

The record

Return Value

YES if record was locally created/updated or deleted

Declared In

SFSyncTarget.h

– getDirtyRecordIds:soupName:idField:

The sync manager

- (NSOrderedSet *)getDirtyRecordIds:(SFMobileSyncSyncManager *)syncManager soupName:(NSString *)soupName idField:(NSString *)idField

Parameters

syncManager

The sync manager

soupName

The soup

idField

The field containing the ids to return

Return Value

ids of “dirty” records (records locally created/upated or deleted)

Declared In

SFSyncTarget.h

– getFromLocalStore:soupName:storeId:

The sync manager

- (NSDictionary *)getFromLocalStore:(SFMobileSyncSyncManager *)syncManager soupName:(NSString *)soupName storeId:(NSNumber *)storeId

Parameters

syncManager

The sync manager

soupName

The soup

storeId

The soup entry id

Return Value

Record from local store by storeId

Declared In

SFSyncTarget.h

– getFromLocalStore:soupName:storeIds:

The sync manager

- (NSArray<NSDictionary*> *)getFromLocalStore:(SFMobileSyncSyncManager *)syncManager soupName:(NSString *)soupName storeIds:(NSArray<NSNumber*> *)storeIds

Parameters

syncManager

The sync manager

soupName

The soup

storeIds

The soup entry ids

Return Value

Records from local store by storeIds

Declared In

SFSyncTarget.h

– deleteFromLocalStore:soupName:record:

Delete record from local store

- (void)deleteFromLocalStore:(SFMobileSyncSyncManager *)syncManager soupName:(NSString *)soupName record:(NSDictionary *)record

Parameters

syncManager

The sync manager

soupName

The soup

record

The record to delete

Declared In

SFSyncTarget.h

+ createLocalId

Generate local id for record

+ (NSString *)createLocalId

Declared In

SFSyncTarget.h

+ isLocalId:

Check if record id was locally generated

+ (BOOL)isLocalId:(NSString *)recordId

Parameters

recordId

The record id

Return Value

YES if recordId was locally generated

Declared In

SFSyncTarget.h

Extension Methods

– getIdsWithQuery:syncManager:

- (NSOrderedSet *)getIdsWithQuery:(id)idsSql syncManager:(SFMobileSyncSyncManager *)syncManager

– getDirtyRecordIdsSql:idField:

- (NSString *)getDirtyRecordIdsSql:(NSString *)soupName idField:(NSString *)idField

– deleteRecordsFromLocalStore:soupName:ids:idField:

- (void)deleteRecordsFromLocalStore:(SFMobileSyncSyncManager *)syncManager soupName:(NSString *)soupName ids:(NSArray *)ids idField:(NSString *)idField

– saveInLocalStore:soupName:records:idFieldName:syncId:lastError:cleanFirst:

- (void)saveInLocalStore:(SFMobileSyncSyncManager *)syncManager soupName:(NSString *)soupName records:(NSArray *)records idFieldName:(NSString *)idFieldName syncId:(NSNumber *)syncId lastError:(NSString *)lastError cleanFirst:(BOOL)cleanFirst