Vantiq Class Reference
Inherits from | NSObject |
---|---|
Declared in | Vantiq.h Vantiq.m |
Overview
The Vantiq class declares the interface for authentication and subsequent interaction with a Vantiq server.
accessToken
Access token to be used for direct Vantiq server operations.
@property (readwrite, nonatomic) NSString *accessToken
Discussion
Access token to be used for direct Vantiq server operations.
Declared In
Vantiq.h
username
User name of the last authenticated user
@property (readwrite, nonatomic) NSString *username
Discussion
User name of the last authenticated user
Declared In
Vantiq.h
namespace
Namespace of the last authenticated user
@property (readonly, nonatomic) NSString *namespace
Discussion
Namespace of the last authenticated user
Declared In
Vantiq.h
serverId
Server ID of the last authenticated user
@property (readonly, nonatomic) NSString *serverId
Discussion
Server ID of the last authenticated user
Declared In
Vantiq.h
appUUID
Unique ID for this installation of the device running the Vantiq SDK
@property (readonly, nonatomic) NSString *appUUID
Discussion
Unique ID for this installation of the device running the Vantiq SDK
Declared In
Vantiq.h
– initWithServer:apiVersion:
Constructor for use with all other Vantiq server operations.
- (id)initWithServer:(NSString *)server apiVersion:(unsigned long)version
Parameters
server |
Server URL, e.g. https://dev.vantiq.com |
---|---|
version |
Version of the Vantiq API to use |
Discussion
Constructor for use with all other Vantiq server operations.
Declared In
Vantiq.h
– initWithServer:
Constructor for use with all other Vantiq server operations. This constructor will use the most recent version of the Vantiq API. If an earlier version of the API is required, use the initWithServer:server apiVersion:version contructor.
- (id)initWithServer:(NSString *)server
Parameters
server |
Server URL, e.g. https://dev.vantiq.com |
---|
Discussion
Constructor for use with all other Vantiq server operations. This constructor will use the most recent version of the Vantiq API. If an earlier version of the API is required, use the initWithServer:server apiVersion:version contructor.
See Also
Declared In
Vantiq.h
– verify:username:completionHandler:
The verify method attempts to validate the given Vantiq server token. If the token has expired or a token has never been issued, the error parameter in the callback will be non-null and the app should then call authenticate (see below) in order to reauthenticate the user. The data parameter returned in the completionHandler is an array of user records for the namespace associated with the access token.
- (void)verify:(NSString *)accessToken username:(NSString *)username completionHandler:(void ( ^ ) ( NSArray *data , NSHTTPURLResponse *response , NSError *error ))handler
Parameters
accessToken |
The access token to verify |
---|---|
username |
The username associated with the token |
handler |
The handler block to execute. |
Discussion
The verify method attempts to validate the given Vantiq server token. If the token has expired or a token has never been issued, the error parameter in the callback will be non-null and the app should then call authenticate (see below) in order to reauthenticate the user. The data parameter returned in the completionHandler is an array of user records for the namespace associated with the access token.
Warning: Please also note this method invokes a callback block associated with a network- related block. Because this block is called from asynchronous network operations, its code must be wrapped by a call to dispatch_async(dispatch_get_main_queue(), ^ {…}); to ensure UI operations are completed on the main thread.
Declared In
Vantiq.h
– authenticate:password:completionHandler:
The authenticate method connects to the Vantiq server with the given authentication credentials used to authorize the user. The username and password credentials are not stored.
- (void)authenticate:(NSString *)username password:(NSString *)password completionHandler:(void ( ^ ) ( NSHTTPURLResponse *response , NSError *error ))handler
Parameters
username |
The username to provide access to the Vantiq server |
---|---|
password |
The password associated with the username |
handler |
The handler block to execute. |
Discussion
The authenticate method connects to the Vantiq server with the given authentication credentials used to authorize the user. The username and password credentials are not stored.
Warning: Please also note this method invokes a callback block associated with a network- related block. Because this block is called from asynchronous network operations, its code must be wrapped by a call to dispatch_async(dispatch_get_main_queue(), ^ {…}); to ensure UI operations are completed on the main thread.
Declared In
Vantiq.h
– retrieveServerId:
The retrieveServerId method retrieves a unique VANTIQ server ID once the user has been authenticated, setting the serverId property in the process. This ID can be used to determine the uniqueness of a server if one server has multiple IP addresses/URL endpoints
- (void)retrieveServerId:(void ( ^ ) ( NSHTTPURLResponse *response , NSError *error ))handler
Parameters
handler |
The handler block to execute. |
---|
Discussion
The retrieveServerId method retrieves a unique VANTIQ server ID once the user has been authenticated, setting the serverId property in the process. This ID can be used to determine the uniqueness of a server if one server has multiple IP addresses/URL endpoints
Warning: Please also note this method invokes a callback block associated with a network- related block. Because this block is called from asynchronous network operations, its code must be wrapped by a call to dispatch_async(dispatch_get_main_queue(), ^ {…}); to ensure UI operations are completed on the main thread.
Declared In
Vantiq.h
– select:props:where:sort:limit:completionHandler:
The select method issues a query to select all matching records for a given type. The select may query both user-defined types as well as system types, such as procedures and types.
- (void)select:(NSString *)type props:(NSArray *)props where:(NSString *)where sort:(NSString *)sort limit:(int)limit completionHandler:(void ( ^ ) ( NSArray *data , NSHTTPURLResponse *response , NSError *error ))handler
Parameters
type |
The data type to query. If querying for a Vantiq system type (e.g. types, sources), add a ‘system.’ prefix to the type (e.g. system.types, system.sources). |
---|---|
props |
Specifies the desired properties to be returned in each record. An empty array or null value means all properties will be returned. The array contains NSStrings. |
where |
Specifies constraints to filter the data. Null means all records will be returned. |
sort |
Specifies the desired sort for the result set. This is a JSON-formatted string. |
limit |
Specifies a limit on the number of records returned. -1 means no limits. If zero or greater, the actual number of records present is returned in the ‘X-Total-Count’ HTTP header. |
handler |
The handler block to execute. |
Return Value
data: array of NSDictionary objects of matching records
response: iOS HTTP operation response
error: iOS error condition response
Discussion
The select method issues a query to select all matching records for a given type. The select may query both user-defined types as well as system types, such as procedures and types.
Warning: Please also note this method invokes a callback block associated with a network- related block. Because this block is called from asynchronous network operations, its code must be wrapped by a call to dispatch_async(dispatch_get_main_queue(), ^ {…}); to ensure UI operations are completed on the main thread.
Declared In
Vantiq.h
– select:props:where:sort:completionHandler:
The select method issues a query to select all matching records for a given type. The select may query both user-defined types as well as system types, such as procedures and types.
- (void)select:(NSString *)type props:(NSArray *)props where:(NSString *)where sort:(NSString *)sort completionHandler:(void ( ^ ) ( NSArray *data , NSHTTPURLResponse *response , NSError *error ))handler
Parameters
type |
The data type to query. If querying for a Vantiq system type (e.g. types, sources), add a ‘system.’ prefix to the type (e.g. system.types, system.sources). |
---|---|
props |
Specifies the desired properties to be returned in each record. An empty array or null value means all properties will be returned. The array contains NSStrings. |
where |
Specifies constraints to filter the data. Null means all records will be returned. |
sort |
Specifies the desired sort for the result set. This is a JSON-formatted string. |
handler |
The handler block to execute. |
Return Value
data: array of NSDictionary objects of matching records
response: iOS HTTP operation response
error: iOS error condition response
Discussion
The select method issues a query to select all matching records for a given type. The select may query both user-defined types as well as system types, such as procedures and types.
Warning: Please also note this method invokes a callback block associated with a network- related block. Because this block is called from asynchronous network operations, its code must be wrapped by a call to dispatch_async(dispatch_get_main_queue(), ^ {…}); to ensure UI operations are completed on the main thread.
Declared In
Vantiq.h
– select:props:where:completionHandler:
The select method issues a query to select all matching records for a given type. The select may query both user-defined types as well as system types, such as procedures and types.
- (void)select:(NSString *)type props:(NSArray *)props where:(NSString *)where completionHandler:(void ( ^ ) ( NSArray *data , NSHTTPURLResponse *response , NSError *error ))handler
Parameters
type |
The data type to query. If querying for a Vantiq system type (e.g. types, sources), add a ‘system.’ prefix to the type (e.g. system.types, system.sources). |
---|---|
props |
Specifies the desired properties to be returned in each record. An empty array or null value means all properties will be returned. The array contains NSStrings. |
where |
Specifies constraints to filter the data. Null means all records will be returned. This is a JSON-formatted string. |
handler |
The handler block to execute. |
Return Value
data: array of NSDictionary objects of matching records
response: iOS HTTP operation response
error: iOS error condition response
Discussion
The select method issues a query to select all matching records for a given type. The select may query both user-defined types as well as system types, such as procedures and types.
Warning: Please also note this method invokes a callback block associated with a network- related block. Because this block is called from asynchronous network operations, its code must be wrapped by a call to dispatch_async(dispatch_get_main_queue(), ^ {…}); to ensure UI operations are completed on the main thread.
It is important to check the response and error callback return values to verify there were no errors returned by the select operation. The callback data returned is an array of NSDictionary objects.
Declared In
Vantiq.h
– select:props:completionHandler:
The select method issues a query to select all matching records for a given type. The select may query both user-defined types as well as system types, such as procedures and types.
- (void)select:(NSString *)type props:(NSArray *)props completionHandler:(void ( ^ ) ( NSArray *data , NSHTTPURLResponse *response , NSError *error ))handler
Parameters
type |
The data type to query. If querying for a Vantiq system type (e.g. types, sources), add a ‘system.’ prefix to the type (e.g. system.types, system.sources). |
---|---|
props |
Specifies the desired properties to be returned in each record. An empty array or null value means all properties will be returned. The array contains NSStrings. |
handler |
The handler block to execute. |
Return Value
data: array of NSDictionary objects of matching records
response: iOS HTTP operation response
error: iOS error condition response
Discussion
The select method issues a query to select all matching records for a given type. The select may query both user-defined types as well as system types, such as procedures and types.
Warning: Please also note this method invokes a callback block associated with a network- related block. Because this block is called from asynchronous network operations, its code must be wrapped by a call to dispatch_async(dispatch_get_main_queue(), ^ {…}); to ensure UI operations are completed on the main thread.
It is important to check the response and error callback return values to verify there were no errors returned by the select operation. The callback data returned is an array of NSDictionary objects.
Declared In
Vantiq.h
– select:completionHandler:
The select method issues a query to select all matching records for a given type. The select may query both user-defined types as well as system types, such as procedures and types.
- (void)select:(NSString *)type completionHandler:(void ( ^ ) ( NSArray *data , NSHTTPURLResponse *response , NSError *error ))handler
Parameters
type |
The data type to query. If querying for a Vantiq system type (e.g. types, sources), add a ‘system.’ prefix to the type (e.g. system.types, system.sources). |
---|---|
handler |
The handler block to execute. |
Return Value
data: array of NSDictionary objects of matching records
response: iOS HTTP operation response
error: iOS error condition response
Discussion
The select method issues a query to select all matching records for a given type. The select may query both user-defined types as well as system types, such as procedures and types.
Warning: Please also note this method invokes a callback block associated with a network- related block. Because this block is called from asynchronous network operations, its code must be wrapped by a call to dispatch_async(dispatch_get_main_queue(), ^ {…}); to ensure UI operations are completed on the main thread.
It is important to check the response and error callback return values to verify there were no errors returned by the select operation. The callback data returned is an array of NSDictionary objects.
Declared In
Vantiq.h
– selectOne:id:completionHandler:
The selectOne method issues a query to select a single record for a given type and unique identifier.
- (void)selectOne:(NSString *)type id:(NSString *)ID completionHandler:(void ( ^ ) ( NSArray *data , NSHTTPURLResponse *response , NSError *error ))handler
Parameters
type |
The data type to query. If querying for a Vantiq system type (e.g. types, sources), add a ‘system.’ prefix to the type (e.g. system.types, system.sources). |
---|---|
ID |
The unique identifier that matches the type’s ‘_id’ property. |
handler |
The handler block to execute. |
Return Value
data: array of NSDictionary objects of matching records
response: iOS HTTP operation response
error: iOS error condition response
Discussion
The selectOne method issues a query to select a single record for a given type and unique identifier.
Warning: Please also note this method invokes a callback block associated with a network- related block. Because this block is called from asynchronous network operations, its code must be wrapped by a call to dispatch_async(dispatch_get_main_queue(), ^ {…}); to ensure UI operations are completed on the main thread.
It is important to check the response and error callback return values to verify there were no errors returned by the selectOne operation. The callback data returned is an array of NSDictionary objects.
Declared In
Vantiq.h
– count:where:completionHandler:
The count method is similar to the select method except it returns only the number of records rather than returning the records themselves.
- (void)count:(NSString *)type where:(NSString *)where completionHandler:(void ( ^ ) ( int count , NSHTTPURLResponse *response , NSError *error ))handler
Parameters
type |
The data type to query. If querying for a Vantiq system type (e.g. types, sources), add a ‘system.’ prefix to the type (e.g. system.types, system.sources). |
---|---|
where |
Specifies constraints to filter the data. Null means all records will be returned. This is a JSON-formatted string. |
handler |
The handler block to execute. |
Return Value
count: number of matching records
response: iOS HTTP operation response
error: iOS error condition response
Discussion
The count method is similar to the select method except it returns only the number of records rather than returning the records themselves.
Warning: Please also note this method invokes a callback block associated with a network- related block. Because this block is called from asynchronous network operations, its code must be wrapped by a call to dispatch_async(dispatch_get_main_queue(), ^ {…}); to ensure UI operations are completed on the main thread.
It is important to check the response and error callback return values to verify there were no errors returned by the count operation. The callback count returned is a count of the items requested.
Declared In
Vantiq.h
– count:completionHandler:
The count method is similar to the select method except it returns only the number of records rather than returning the records themselves.
- (void)count:(NSString *)type completionHandler:(void ( ^ ) ( int count , NSHTTPURLResponse *response , NSError *error ))handler
Parameters
type |
The data type to query. If querying for a Vantiq system type (e.g. types, sources), add a ‘system.’ prefix to the type (e.g. system.types, system.sources). |
---|---|
handler |
The handler block to execute. |
Return Value
count: number of matching records
response: iOS HTTP operation response
error: iOS error condition response
Discussion
The count method is similar to the select method except it returns only the number of records rather than returning the records themselves.
Warning: Please also note this method invokes a callback block associated with a network- related block. Because this block is called from asynchronous network operations, its code must be wrapped by a call to dispatch_async(dispatch_get_main_queue(), ^ {…}); to ensure UI operations are completed on the main thread.
It is important to check the response and error callback return values to verify there were no errors returned by the count operation. The callback count returned is a count of the items requested.
See Also
Declared In
Vantiq.h
– insert:object:completionHandler:
The insert method creates a new record of a given type.
- (void)insert:(NSString *)type object:(NSString *)object completionHandler:(void ( ^ ) ( NSDictionary *data , NSHTTPURLResponse *response , NSError *error ))handler
Parameters
type |
The data type to query. If querying for a Vantiq system type (e.g. types, sources), add a ‘system.’ prefix to the type (e.g. system.types, system.sources). |
---|---|
object |
The JSON-formated string data to insert. |
handler |
The handler block to execute. |
Return Value
data: copy of the inserted data
response: iOS HTTP operation response
error: iOS error condition response
Discussion
The insert method creates a new record of a given type.
Warning: Please also note this method invokes a callback block associated with a network- related block. Because this block is called from asynchronous network operations, its code must be wrapped by a call to dispatch_async(dispatch_get_main_queue(), ^ {…}); to ensure UI operations are completed on the main thread.
It is important to check the response and error callback return values to verify there were no errors returned by the insert operation. The callback data returned is a copy of the inserted data.
Declared In
Vantiq.h
– update:id:object:completionHandler:
The update method updates an existing record of a given type. This method supports partial updates meaning that only the properties provided are updated. Any properties not specified are not changed in the underlying record.
- (void)update:(NSString *)type id:(NSString *)ID object:(NSString *)object completionHandler:(void ( ^ ) ( NSDictionary *data , NSHTTPURLResponse *response , NSError *error ))handler
Parameters
type |
The data type to query. If querying for a Vantiq system type (e.g. types, sources), add a ‘system.’ prefix to the type (e.g. system.types, system.sources). |
---|---|
ID |
The “_id” internal identifier for the record. |
object |
The JSON-formated string data to update. |
handler |
The handler block to execute. |
Return Value
data: copy of the updated data
response: iOS HTTP operation response
error: iOS error condition response
Discussion
The update method updates an existing record of a given type. This method supports partial updates meaning that only the properties provided are updated. Any properties not specified are not changed in the underlying record.
Warning: Please also note this method invokes a callback block associated with a network- related block. Because this block is called from asynchronous network operations, its code must be wrapped by a call to dispatch_async(dispatch_get_main_queue(), ^ {…}); to ensure UI operations are completed on the main thread.
It is important to check the response and error callback return values to verify there were no errors returned by the insert operation. The callback data returned is a copy of the updated data.
Declared In
Vantiq.h
– upsert:object:completionHandler:
The upsert method either creates or updates a record in the database depending if the record already exists. The method tests for existence by looking at the natural keys defined on the type.
- (void)upsert:(NSString *)type object:(NSString *)object completionHandler:(void ( ^ ) ( NSDictionary *data , NSHTTPURLResponse *response , NSError *error ))handler
Parameters
type |
The data type to query. If querying for a Vantiq system type (e.g. types, sources), add a ‘system.’ prefix to the type (e.g. system.types, system.sources) |
---|---|
object |
The JSON-formated string data to upsert. |
handler |
The handler block to execute. |
Return Value
data: copy of the upserted data
response: iOS HTTP operation response
error: iOS error condition response
Discussion
The upsert method either creates or updates a record in the database depending if the record already exists. The method tests for existence by looking at the natural keys defined on the type.
Warning: Please also note this method invokes a callback block associated with a network- related block. Because this block is called from asynchronous network operations, its code must be wrapped by a call to dispatch_async(dispatch_get_main_queue(), ^ {…}); to ensure UI operations are completed on the main thread.
It is important to check the response and error callback return values to verify there were no errors returned by the insert operation. The callback data returned is a copy of the upserted data.
Declared In
Vantiq.h
– delete:resourceId:completionHandler:
This delete method removes records from the system for a given type. Use this form of delete for system types which require the name of the type in order to perform the delete.
- (void)delete:(NSString *)type resourceId:(NSString *)resourceId completionHandler:(void ( ^ ) ( NSHTTPURLResponse *response , NSError *error ))handler
Parameters
type |
The data type to query. If querying for a Vantiq system type (e.g. types, sources), add a ‘system.’ prefix to the type (e.g. system.types, system.sources). |
---|---|
resourceId |
The resource identifier. This is a string and is mostly but not always associated with the type’s ‘name’ property. |
handler |
The handler block to execute. |
Discussion
This delete method removes records from the system for a given type. Use this form of delete for system types which require the name of the type in order to perform the delete.
Warning: Please also note this method invokes a callback block associated with a network- related block. Because this block is called from asynchronous network operations, its code must be wrapped by a call to dispatch_async(dispatch_get_main_queue(), ^ {…}); to ensure UI operations are completed on the main thread.
It is important to check the response and error callback return values to verify there were no errors returned by the deleteOne operation.
Declared In
Vantiq.h
– delete:where:completionHandler:
This delete method removes records from the system for a given type. Deletes always require a constraint indicating which records to remove.
- (void)delete:(NSString *)type where:(NSString *)where completionHandler:(void ( ^ ) ( NSHTTPURLResponse *response , NSError *error ))handler
Parameters
type |
The data type to query. If querying for a Vantiq system type (e.g. types, sources), add a ‘system.’ prefix to the type (e.g. system.types, system.sources). |
---|---|
where |
Specifies constraints to filter the data. This is a JSON-formatted string. |
handler |
The handler block to execute. |
Discussion
This delete method removes records from the system for a given type. Deletes always require a constraint indicating which records to remove.
Warning: Please also note this method invokes a callback block associated with a network- related block. Because this block is called from asynchronous network operations, its code must be wrapped by a call to dispatch_async(dispatch_get_main_queue(), ^ {…}); to ensure UI operations are completed on the main thread.
It is important to check the response and error callback return values to verify there were no errors returned by the deleteOne operation.
Declared In
Vantiq.h
– deleteOne:id:completionHandler:
The deleteOne method issues a query to delete a single record for a given type and unique identifier.
- (void)deleteOne:(NSString *)type id:(NSString *)ID completionHandler:(void ( ^ ) ( NSHTTPURLResponse *response , NSError *error ))handler
Parameters
type |
The data type to query. If querying for a Vantiq system type (e.g. types, sources), add a ‘system.’ prefix to the type (e.g. system.types, system.sources). |
---|---|
ID |
The unique identifier that matches the type’s ‘_id’ property. |
handler |
The handler block to execute. |
Discussion
The deleteOne method issues a query to delete a single record for a given type and unique identifier.
Warning: Please also note this method invokes a callback block associated with a network- related block. Because this block is called from asynchronous network operations, its code must be wrapped by a call to dispatch_async(dispatch_get_main_queue(), ^ {…}); to ensure UI operations are completed on the main thread.
It is important to check the response and error callback return values to verify there were no errors returned by the delete operation.
See Also
Declared In
Vantiq.h
– publish:message:completionHandler:
The publish method publishes a message onto a given topic. Messages published onto topics can trigger rules to facilitate identifying situations.
- (void)publish:(NSString *)topic message:(NSString *)message completionHandler:(void ( ^ ) ( NSHTTPURLResponse *response , NSError *error ))handler
Parameters
topic |
The topic on which to publish. |
---|---|
message |
The message to publish. This is a JSON-formatted string. |
handler |
The handler block to execute. |
Discussion
The publish method publishes a message onto a given topic. Messages published onto topics can trigger rules to facilitate identifying situations.
Topics are slash-delimited strings, such as ‘/test/topic’. Vantiq system-defined topics begin with /type, /property, /system, and /source.
Warning: Please also note this method invokes a callback block associated with a network- related block. Because this block is called from asynchronous network operations, its code must be wrapped by a call to dispatch_async(dispatch_get_main_queue(), ^ {…}); to ensure UI operations are completed on the main thread.
It is important to check the response and error callback return values to verify there were no errors returned by the publish operation.
Declared In
Vantiq.h
– execute:params:completionHandler:
The execute method executes a procedure on the Vantiq server. Procedures can take parameters (i.e. arguments) and produce a result.
- (void)execute:(NSString *)procedure params:(NSString *)params completionHandler:(void ( ^ ) ( id data , NSHTTPURLResponse *response , NSError *error ))handler
Parameters
procedure |
The procedure to execute. The parameters may be provided as an array where the arguments are given in order. Alternatively, the parameters may be provided as an object where the arguments are named. |
---|---|
params |
Parameters passed to the procedure. This is a JSON-formatted string. |
handler |
The handler block to execute. |
Return Value
data: result of method execution, if any, usually an NSDictionary or NSArray (use isKindOfClass to determine)
response: iOS HTTP operation response
error: iOS error condition response
Discussion
The execute method executes a procedure on the Vantiq server. Procedures can take parameters (i.e. arguments) and produce a result.
Warning: Please also note this method invokes a callback block associated with a network- related block. Because this block is called from asynchronous network operations, its code must be wrapped by a call to dispatch_async(dispatch_get_main_queue(), ^ {…}); to ensure UI operations are completed on the main thread.
It is important to check the response and error callback return values to verify there were no errors returned by the execute operation. The callback data returns the results of the procedure, if any.
Declared In
Vantiq.h
– execute:completionHandler:
The execute method executes a procedure on the Vantiq server. Procedures can take parameters (i.e. arguments) and produce a result.
- (void)execute:(NSString *)procedure completionHandler:(void ( ^ ) ( id data , NSHTTPURLResponse *response , NSError *error ))handler
Parameters
procedure |
The procedure to execute. The parameters may be provided as an array where the arguments are given in order. Alternatively, the parameters may be provided as an object where the arguments are named. |
---|---|
handler |
The handler block to execute. |
Return Value
data: result of method execution, if any, usually an NSDictionary or NSArray (use isKindOfClass to determine)
response: iOS HTTP operation response
error: iOS error condition response
Discussion
The execute method executes a procedure on the Vantiq server. Procedures can take parameters (i.e. arguments) and produce a result.
Warning: Please also note this method invokes a callback block associated with a network- related block. Because this block is called from asynchronous network operations, its code must be wrapped by a call to dispatch_async(dispatch_get_main_queue(), ^ {…}); to ensure UI operations are completed on the main thread.
It is important to check the response and error callback return values to verify there were no errors returned by the execute operation. The callback data returns the results of the procedure, if any.
See Also
Declared In
Vantiq.h
– registerForPushNotifications:completionHandler:
The registerForPushNotifications method registers an app to receive Apple Push Notifications. Please note that you must enable the iOS app for Push Notifications and for the remote-notifications Background Mode, in addition to assigning a bundle identifier in both the app and in the app definition and provisioning profiles at the Apple Developer site.
- (void)registerForPushNotifications:(NSString *)APNSDeviceToken completionHandler:(void ( ^ ) ( NSDictionary *data , NSHTTPURLResponse *response , NSError *error ))handler
Parameters
APNSDeviceToken |
The APNS Device Token returned by the registerForRemoteNotifications method. |
---|---|
handler |
The handler block to execute. |
Return Value
data: result of method execution, if any
response: iOS HTTP operation response
error: iOS error condition response
Discussion
The registerForPushNotifications method registers an app to receive Apple Push Notifications. Please note that you must enable the iOS app for Push Notifications and for the remote-notifications Background Mode, in addition to assigning a bundle identifier in both the app and in the app definition and provisioning profiles at the Apple Developer site.
Warning: Please also note this method invokes a callback block associated with a network- related block. Because this block is called from asynchronous network operations, its code must be wrapped by a call to dispatch_async(dispatch_get_main_queue(), ^ {…}); to ensure UI operations are completed on the main thread.
It is important to check the response and error callback return values to verify there were no errors returned by the execute operation. The callback data returns the results of the procedure, if any.
Declared In
Vantiq.h
– uploadDocument:fileName:filePrefix:contentType:completionHandler:
The uploadDocument method uploads the given file, specified by the full path and file name, with any directory prefix and the given content type (MIME type). The upload process creates an ArsDocument record which contains the contents of the file. This method invokes the following method but passes the default @“/resources/documents” value for the resourcePath parameter.
- (void)uploadDocument:(NSString *)filePath fileName:(NSString *)fileName filePrefix:(NSString *)filePrefix contentType:(NSString *)contentType completionHandler:(void ( ^ ) ( NSHTTPURLResponse *response , NSError *error ))handler
Parameters
filePath |
The full path to the document, for example in the NSDocumentDirectory appended with the file name |
---|---|
fileName |
The file name which also contains its file extension |
filePrefix |
Any directory prefix to be added to the file path when it’s uploaded |
contentType |
The MIME type of the file contents |
handler |
The handler block to execute |
Return Value
data: result of method execution, if any
response: iOS HTTP operation response
error: iOS error condition response
Discussion
The uploadDocument method uploads the given file, specified by the full path and file name, with any directory prefix and the given content type (MIME type). The upload process creates an ArsDocument record which contains the contents of the file. This method invokes the following method but passes the default @“/resources/documents” value for the resourcePath parameter.
Warning: Please also note this method invokes a callback block associated with a network- related block. Because this block is called from asynchronous network operations, its code must be wrapped by a call to dispatch_async(dispatch_get_main_queue(), ^ {…}); to ensure UI operations are completed on the main thread.
It is important to check the response and error callback return values to verify there were no errors returned by the execute operation. The callback data returns the results of the procedure, if any.
Declared In
Vantiq.h
– uploadDocument:fileName:filePrefix:contentType:resourcePath:completionHandler:
The uploadDocument method uploads the given file, specified by the full path and file name, with any directory prefix and the given content type (MIME type). The upload process creates an ArsDocument record which contains the contents of the file.
- (void)uploadDocument:(NSString *)filePath fileName:(NSString *)fileName filePrefix:(NSString *)filePrefix contentType:(NSString *)contentType resourcePath:(NSString *)resourcePath completionHandler:(void ( ^ ) ( NSHTTPURLResponse *response , NSError *error ))handler
Parameters
filePath |
The full path to the document, for example in the NSDocumentDirectory appended with the file name |
---|---|
fileName |
The file name which also contains its file extension |
filePrefix |
Any directory prefix to be added to the file path when it’s uploaded |
contentType |
The MIME type of the file contents |
resourcePath |
String specification of the destination resource, e.g. @“/resources/documents”, @“/resources/images” or @“/resources/videos” |
handler |
The handler block to execute |
Return Value
data: result of method execution, if any
response: iOS HTTP operation response
error: iOS error condition response
Discussion
The uploadDocument method uploads the given file, specified by the full path and file name, with any directory prefix and the given content type (MIME type). The upload process creates an ArsDocument record which contains the contents of the file.
Warning: Please also note this method invokes a callback block associated with a network- related block. Because this block is called from asynchronous network operations, its code must be wrapped by a call to dispatch_async(dispatch_get_main_queue(), ^ {…}); to ensure UI operations are completed on the main thread.
It is important to check the response and error callback return values to verify there were no errors returned by the execute operation. The callback data returns the results of the procedure, if any.
Declared In
Vantiq.h