VLDSession Class Reference
Inherits from | NSObject |
---|---|
Declared in | VLDSession.h |
Overview
VLDSession stores a user, their current HealthKit subscriptions and all pending record uploads. This data is persisted between app launches but is deleted if endSession is called.
VLDSession is a singleton object and must be accessed by its sharedInstance method. The different components of the Validic Mobile library rely on a valid user existing in the current VLDSession singleton object.
Notifications
When VLDSession uploads a record it will send an NSNotification. To listen for this
notification add an observer to the NSNotificationCenter with the name kVLDRecordSubmittedNotification
.
The object
property of the notification will contain the VLDRecord object uploaded.
If a 400 error is returned from the server, the record will be discarded and an NSNotification will be posted.
To listen for this notification add an observer to the NSNotificationCenter with the name
kVLDRecordSubmissionFailedNotification
. The object
property of the notification
will contain the invalid VLDRecord object.
The userInfo dictionary for this notification will contain one key, error
with the NSError object
for the failed upload.
When an image is uploaded VLDSession will send out an NSNotification with the name kVLDRecordImageSubmittedNotification
.
The object
property of the notification will contain a VLDMedia
instance. If the image
fails to upload an NSNotification will be sent out with the name kVLDRecordImageSubmissionFailedNotification
and the
object
property of the notification will be the record object associated with the image and the userInfo
dictionary
will contain a value for the key error
with the NSError object describing the problem.
user
The user for the current session.
@property (nonatomic, readonly) VLDUser *user
Discussion
The user for the current session.
Declared In
VLDSession.h
+ libraryVersion
Version of the ValidicMobile library in a string comprised of three period-separated integers/
+ (NSString *)libraryVersion
Discussion
Version of the ValidicMobile library in a string comprised of three period-separated integers/
Declared In
VLDSession.h
+ libraryHasFeature:
Indicates if the library supports the specified feature.
+ (BOOL)libraryHasFeature:(VLDLibraryFeature)feature
Parameters
feature |
the library feature being checked for. |
---|
Discussion
Indicates if the library supports the specified feature.
Declared In
VLDSession.h
+ sharedInstance
sharedInstance returns the VLDSession singleton and should be the only way VLDSession is accessed.
+ (instancetype)sharedInstance
Discussion
sharedInstance returns the VLDSession singleton and should be the only way VLDSession is accessed.
Declared In
VLDSession.h
– startSessionWithUser:
Starts a new session with the specified user. Deletes existing session if present.
- (void)startSessionWithUser:(VLDUser *)user
Parameters
user |
the Validic user that owns the session data. |
---|
Discussion
Starts a new session with the specified user. Deletes existing session if present.
Declared In
VLDSession.h
– endSession
Removes all locally stored session data.
- (void)endSession
Discussion
Removes all locally stored session data.
Declared In
VLDSession.h
– submitRecord:image:
Queues a VLDRecord with an image for submission.
- (void)submitRecord:(VLDRecord *)record image:(UIImage *)image
Parameters
record |
the record to be submitted. |
---|---|
image |
the image associated with the record. |
Discussion
Queues a VLDRecord with an image for submission.
This method should be used to submit records created by VLDOCRController along with the image processed.
Declared In
VLDSession.h
– submitRecords:
Queues an array of VLDRecord objects for submission. This arrray may contain more than one type of VLDRecord subclass.
- (void)submitRecords:(NSArray<__kindofVLDRecord*> *)records
Parameters
records |
the records to be submitted. |
---|
Discussion
Queues an array of VLDRecord objects for submission. This arrray may contain more than one type of VLDRecord subclass.
Declared In
VLDSession.h
– processQueue
Calling this method will begin uploading all pending records.
- (void)processQueue
Discussion
Calling this method will begin uploading all pending records.
In most situations it is not necessary to call this method as the system will automatically attempt to process the queue at the correct times.
Declared In
VLDSession.h