KNYSync Class Reference
Inherits from | NSObject |
Declared in | KNYSync.h |
Tasks
-
– init
-
syncEventDelegate
property -
backgroundTransferCompletionHandler
property -
+ sharedInstance
-
– initSync
-
– initSyncInBackground:
-
– initSyncWithPassPhrase:
-
– initSyncWithPassPhrase:inBackGround:
-
– startSessionInBackground
-
– resetSync
-
– resetSyncInBackground:
-
– setServerURL:
-
– setServerURL:portNumber:
-
– setServerURL:portNumber:isSecure:
-
– setUserId:
-
– setPassword:
-
– setAppId:
-
– setAuthToken:
-
– setDownloadBatchSize:
-
– setUploadBatchSize:
-
– setSyncOptions:
-
– resetSyncOptions
-
+ storeableDateFormat:
-
– hasDateFormatter
-
– setDateFormat:
-
– dateFromString:
-
– stringFromDate:
-
– isUpgradeRequiredInBackground
-
– performUpgradeInBackground
-
– registerCompletionHandler:forSessionIdentifier:
-
– removeCompletionHandlerForSession:
-
– setDeviceId:
-
– setSyncServiceEndPoint:
Properties
Class Methods
sharedInstance
Creates and returns instance of KNYSync.
+ (instancetype)sharedInstance
Return Value
returns an instance of KNYSync.
Discussion
Creates and returns instance of KNYSync.
Declared In
KNYSync.h
storeableDateFormat:
Generate an NSDateFormatter.
+ (NSDateFormatter *)storeableDateFormat:(NSString *)format
Parameters
- format
A valid NSDateFormatter format string.
Return Value
A NSDateFormatter
that can be used for converting dates to strings and vice versa.
Discussion
Generate an NSDateFormatter.
Use this method to generate values to set the dateFormat property.
Declared In
KNYSync.h
Instance Methods
dateFromString:
Convert the supplied NSString to NSDate, using the current database formatter.
- (NSDate *)dateFromString:(NSString *)s
Parameters
- s
NSString
to convert toNSDate
.
Return Value
nil
if no formatter is set.
Discussion
Convert the supplied NSString to NSDate, using the current database formatter.
Declared In
KNYSync.h
hasDateFormatter
Test whether the database has a date formatter assigned.
- (BOOL)hasDateFormatter
Return Value
YES
if there is a date formatter; NO
if not.
Discussion
Test whether the database has a date formatter assigned.
Declared In
KNYSync.h
initSync
Initializes the sync.
- (void)initSync
Discussion
Initializes the sync.
Exceptions
- KNYException
is Thrown, if any error occured during init process
Declared In
KNYSync.h
initSyncInBackground:
Initializes the sync in background.
- (void)initSyncInBackground:(KNYBooleanResultBlock)result
Parameters
- a
block which of the format ^(BOOL succeeded, NSError *error);
Discussion
Initializes the sync in background.
Declared In
KNYSync.h
initSyncWithPassPhrase:
Initializes the sync.
- (void)initSyncWithPassPhrase:(NSString *)passPhrase
Parameters
- passPhrase
passPhrase for database encryption
Discussion
Initializes the sync.
Exceptions
- KNYException
is Thrown, if any error occured during init(with encryption)process
Declared In
KNYSync.h
initSyncWithPassPhrase:inBackGround:
Initializes the sync.
- (void)initSyncWithPassPhrase:(NSString *)passPhrase inBackGround:(KNYBooleanResultBlock)result
Parameters
- passPhrase
passPhrase for database encryption
- a
block which of the format ^(BOOL succeeded, NSError *error);
Discussion
Initializes the sync.
Declared In
KNYSync.h
isUpgradeRequiredInBackground
check whether sync upgrade is required from sync server
- (void)isUpgradeRequiredInBackground
Discussion
check whether sync upgrade is required from sync server
Declared In
KNYSync.h
performUpgradeInBackground
perform sync upgrade
- (void)performUpgradeInBackground
Discussion
perform sync upgrade
Declared In
KNYSync.h
registerCompletionHandler:forSessionIdentifier:
register the registerCompletion handler for each session identifier.
- (void)registerCompletionHandler:(id)completionHandler forSessionIdentifier:(NSString *)identifier
Parameters
- completionHandler
completionHandler for each sessionIdentfier.
- identifier
session identifier
Discussion
register the registerCompletion handler for each session identifier.
Declared In
KNYSync.h
removeCompletionHandlerForSession:
removeCompletionHandlerForSession.
- (void)removeCompletionHandlerForSession:(id)session
Parameters
- completionHandler
completionHandler corresponding a particular session.
- identifier
session identifier
Discussion
removeCompletionHandlerForSession.
Declared In
KNYSync.h
resetSync
Reset the local device database.
- (void)resetSync
Discussion
Reset the local device database.
Exceptions
- KNYException
is Thrown, if any error occured during sync reset process
Declared In
KNYSync.h
resetSyncInBackground:
Reset the local device database.
- (void)resetSyncInBackground:(KNYBooleanResultBlock)result
Parameters
- a
block which of the format ^(BOOL succeeded, NSError *error);
Discussion
Reset the local device database.
Declared In
KNYSync.h
resetSyncOptions
Resets all sync options to their default values
- (void)resetSyncOptions
Discussion
Resets all sync options to their default values
Exceptions
- KNYException
is Thrown, if any error occured
Declared In
KNYSync.h
setAppId:
Sets the appplication ID
- (void)setAppId:(NSString *)appId
Parameters
- password
appId
Discussion
Sets the appplication ID
Exceptions
- KNYException
is Thrown, if any error occured during setAppId process
Declared In
KNYSync.h
setAuthToken:
Sets the auth token for the synchronization
- (void)setAuthToken:(NSString *)authToken
Parameters
- authToken
authToken
Discussion
Sets the auth token for the synchronization
Exceptions
- KNYException
is Thrown, if any error occured during setAuthToken process
Declared In
KNYSync.h
setDateFormat:
Set to a date formatter to use string dates with sqlite instead of the default UNIX timestamps.
- (void)setDateFormat:(NSDateFormatter *)format
Parameters
- format
Set to nil to use UNIX timestamps. Defaults to nil. Should be set using a formatter generated using KNYSync::storeableDateFormat.
Discussion
Set to a date formatter to use string dates with sqlite instead of the default UNIX timestamps.
Declared In
KNYSync.h
setDeviceId:
sets the setDevice ID @param deviceID
- (void)setDeviceId:(NSString *)deviceId
Discussion
sets the setDevice ID @param deviceID
Declared In
KNYSync.h
setDownloadBatchSize:
Sets the download batch size
- (void)setDownloadBatchSize:(int)batchSize
Parameters
- batchSize
download batchSize
Discussion
Sets the download batch size
Exceptions
- KNYException
is Thrown, if any error occured during setDownloadBatchSize process
Declared In
KNYSync.h
setPassword:
Sets the password for authenticating during synchronization.
- (void)setPassword:(NSString *)password
Parameters
- password
password
Discussion
Sets the password for authenticating during synchronization.
Exceptions
- KNYException
is Thrown, if any error occured during setPassword process
Declared In
KNYSync.h
setServerURL:
Sets the sync server URL without the port
- (void)setServerURL:(NSString *)url
Parameters
- url
syncServerURL
Discussion
Sets the sync server URL without the port
Exceptions
- KNYException
is Thrown, if any error occured during setServerURL process
Declared In
KNYSync.h
setServerURL:portNumber:
Sets the sync server URL and port
- (void)setServerURL:(NSString *)url portNumber:(NSString *)portNumber
Parameters
- url
syncServerURL
- portNumber
portNumber
Discussion
Sets the sync server URL and port
Exceptions
- KNYException
is Thrown, if any error occured during setServerURLPortNumber process
Declared In
KNYSync.h
setServerURL:portNumber:isSecure:
Sets the sync server URL and port
- (void)setServerURL:(NSString *)url portNumber:(NSString *)portNumber isSecure:(BOOL)isSecure
Parameters
- url
syncServerURL
- portNumber
portNumber
- isSecure
if YES secure way of sending request to Sync server
Discussion
Sets the sync server URL and port
Exceptions
- KNYException
is Thrown, if any error occured during setServerURLPortNumberIsSecure process
Declared In
KNYSync.h
setSyncOptions:
Sets various sync options options
- (void)setSyncOptions:(KNYSyncOptions *)knySyncOptions
Discussion
Sets various sync options options
Exceptions
- KNYException
is Thrown, if any error occured during setSyncOptions process
@param syncOptions
Declared In
KNYSync.h
setSyncServiceEndPoint:
sets the end point url for sync service
- (void)setSyncServiceEndPoint:(NSString *)URLString
Parameters
- URLString
end point url
Discussion
sets the end point url for sync service
Declared In
KNYSync.h
setUploadBatchSize:
Sets the upload batch size
- (void)setUploadBatchSize:(int)batchSize
Parameters
- batchSize
upload batchSize
Discussion
Sets the upload batch size
Exceptions
- KNYException
is Thrown, if any error occured during setUploadBatchSize process
Declared In
KNYSync.h
setUserId:
Sets the userid for authenticating during synchronization.
- (void)setUserId:(NSString *)userId
Parameters
- userId
userId
Discussion
Sets the userid for authenticating during synchronization.
Exceptions
- KNYException
is Thrown, if any error occured during setUserId process
Declared In
KNYSync.h
startSessionInBackground
Start the sync process in background thread
- (void)startSessionInBackground
Discussion
Start the sync process in background thread
Exceptions
- KNYException
is Thrown, if sync session is already in progress.
Declared In
KNYSync.h
stringFromDate:
Convert the supplied NSDate to NSString, using the current database formatter.
- (NSString *)stringFromDate:(NSDate *)date
Parameters
- date
NSDate
of date to convert toNSString
.
Return Value
nil
if no formatter is set.
Discussion
Convert the supplied NSDate to NSString, using the current database formatter.
Declared In
KNYSync.h