Inherits from NSObject
Declared in APSCloud.h

Overview

The APSCloud interface allows the application to configure the client and make generic REST requests to the APS Cloud servers.

After configuring your APS Cloud settings, call the sharedInstance method to get the shared instance of the cloud client. Use this instance to make generic REST API calls with the sendRequest methods.

For information on getting started with Appcelerator Platform Services, see Appclerator Platform Services Native SDKs.

Callbacks

The Cloud API makes asychronous calls and relies on callbacks to handle the response.

Both the APSCloudObjects and APSClient methods take a server response handler and an optional progress handler.

APSResponseHandler

Callback function to handle the server response of the request. Runs in a background thread. To update the UI, switch to the main thread.

typedef void (^APSResponseHandler)(APSResponse *e)

Parameters

e
Response received from the server. See APSResponse.

APSProgressHandler

Callback function to handle the progress of the API call. Runs in a background thread. To update the UI, switch to the main thread.

typedef void (^APSProgressHandler)(float progress, BOOL upload)

Parameters

progress
Value of the progress as a float (0 - 1.0)
upload
If true, the request is uploading data.

Tasks

Properties

timeout

Timeout for REST requests in seconds

@property (atomic, readwrite) NSTimeInterval timeout

Discussion

Timeout for REST requests in seconds

Declared In

APSCloud.h

Class Methods

sharedInstance

Retrieves the share instance of the client

+ (instancetype)sharedInstance

Return Value

The shared instance of the client

Discussion

Retrieves the share instance of the client

Declared In

APSCloud.h

Instance Methods

sendRequest:method:data:handler:

Sends a generic REST request to the server specified by the APSCloud.baseURL setting

- (void)sendRequest:(NSString *)url method:(NSString *)method data:(NSDictionary *)data handler:(APSResponseHandler)handler

Parameters

url

The last fragment of request url

method

It only can be one of “GET”, “POST”, “PUT”, “DELETE”.

data

The name-value pairs which is ready to be sent to server. Supported data types: NSString, NSNumber, NSArray(of supported data types), NSDictionary(of supported data types), NSData, NSURL(to a local file).

handler

The block called when the request completes

Discussion

Sends a generic REST request to the server specified by the APSCloud.baseURL setting

Declared In

APSCloud.h

sendRequest:method:data:handler:progress:

Sends a generic REST request to the server specified by the APSCloud.baseURL setting

- (void)sendRequest:(NSString *)url method:(NSString *)method data:(NSDictionary *)data handler:(APSResponseHandler)handler progress:(APSProgressHandler)progressHandler

Parameters

url

The last fragment of request url

method

It only can be one of “GET”, “POST”, “PUT”, “DELETE”.

data

The name-value pairs which is ready to be sent to server. Supported data types: NSString, NSNumber, NSArray(of supported data types), NSDictionary(of supported data types), NSData, NSURL(to a local file).

handler

The block called when the request completes

progressHandler

The block called with progress updates for uploading data

Discussion

Sends a generic REST request to the server specified by the APSCloud.baseURL setting

Declared In

APSCloud.h