VocService
IntroductionVocService encapsulates the functionality provided by Voc SDK. DiscussionVocService instance is created through VocServiceFactory. To create the service, a delegate implementing VocServiceDelegate protocol and delegate queue are required. In most cases the delegate queue will be the main app queue, however there is no restriction what type of queue to use. If the queue is not serial then users of Voc SDK must ensure voc item objects are accessed serially since they are not thread safe. One such way to achieve that would be to add a lock object of some kind to voc item userInfo and use it to serialize access. VocService state is available through VocService.state property. Initially VocService is in VOCServiceStateNotRegistered state until it is successfully registered with VoC server. To register call [VocService registerService]. VocService might become unregistered and return to VOCServiceStateNotRegistered state if the user is deleted from server or some time has passed since SDK could connect to VoC server. Methods
application:didReceiveRemoteNotification:fetchCompletionHandler:Must be invoked when remote notification is received to let Voc SDK process it. - (BOOL)application:(nonnull UIApplication *)application didReceiveRemoteNotification:(nonnull NSDictionary *)userInfo fetchCompletionHandler:(nonnull void (^)(UIBackgroundFetchResult result))completionHandler; Parameters
Return ValueWill return YES if the remote notification is for voc service, otherwise NO. application:performFetchWithCompletionHandler:Must be invoked when OS wakes up app in background to perform fetch. - (BOOL)application:(nonnull UIApplication *)application performFetchWithCompletionHandler:(nonnull void (^)(UIBackgroundFetchResult result))completionHandler; Parameters
Return ValueWill return YES if voc service performs operations in background. networkQualityGets the current network quality. - (nullable id<VocNetworkQuality>) networkQuality; setDevicePushToken:Must be set to the device APNS push token in order push notifications to work. - (void)setDevicePushToken:(NSData * __nullable)devicePushToken; ParametersunregisterService:Unregisters voc service with Voc server and stops downloading. - (void)unregisterService:(nullable void (^)(NSError * __nullable))completion; Properties
cacheAvailableThe remaining storage available for downloaded files (bytes). This is the smaller values of the unused cache and the space available on device. @property (readonly, assign, nonatomic) uint64_t cacheAvailable; cacheSizeSize of the cache for downloaded files (bytes). @property (readwrite, assign, nonatomic) uint64_t cacheSize; cacheUsedThe amount of storage used for downloaded files (bytes). @property (readonly, assign, nonatomic) uint64_t cacheUsed; configProvides access to various configations properties of voc service. @property (readonly, nonnull, strong, nonatomic) id<VocConfig> config; connectionTypeGives the current network connection type and if there is one at all. @property (readonly, assign, nonatomic) VOCConnectionType connectionType; devicePushTokenStringApple Push Notification service(APNS) push token in readable format (read-only). @property (readonly, nullable, strong, atomic) NSString *devicePushTokenString; downloadAllowedShows if voc service policies allow downloads at the moment. @property (readonly, assign, nonatomic) BOOL downloadAllowed; lastPolicyStatusAccess the last policy status of voc service. @property (readonly, assign, nonatomic) VOCPolicyStatus lastPolicyStatus; sortedLogFilePathsList of SDK log files. @property (readonly, nullable, strong, atomic) NSArray* sortedLogFilePaths; stateThe current state of voc service. @property (readonly, assign, nonatomic) VOCServiceState state; |