CloudMine iOS SDK  1.5.7
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Pages
CMStore Class Reference

#import <CMStore.h>

Inherits NSObject.

Inherited by CMNullStore.

Instance Methods

(id) - init
 
(id) - initWithUser:
 
(void) - registerForPushNotifications:callback:
 
(void) - registerForPushNotifications:user:callback:
 
(void) - unRegisterForPushNotificationsWithCallback:
 
(void) - allObjectsWithOptions:callback:
 
(void) - allUserObjectsWithOptions:callback:
 
(void) - allACLs:
 
(void) - objectsWithKeys:additionalOptions:callback:
 
(void) - userObjectsWithKeys:additionalOptions:callback:
 
(void) - allObjectsOfClass:additionalOptions:callback:
 
(void) - allUserObjectsOfClass:additionalOptions:callback:
 
(void) - searchObjects:additionalOptions:callback:
 
(void) - searchUserObjects:additionalOptions:callback:
 
(void) - searchACLs:callback:
 
(void) - fileWithName:additionalOptions:callback:
 
(void) - userFileWithName:additionalOptions:callback:
 
(void) - saveAll:
 
(void) - saveAllWithOptions:callback:
 
(void) - saveAllAppObjects:
 
(void) - saveAllAppObjectsWithOptions:callback:
 
(void) - saveAllUserObjects:
 
(void) - saveAllUserObjectsWithOptions:callback:
 
(void) - saveAllACLs:
 
(void) - saveObject:callback:
 
(void) - saveObject:additionalOptions:callback:
 
(void) - saveUserObject:callback:
 
(void) - saveUserObject:additionalOptions:callback:
 
(void) - saveACL:callback:
 
(void) - saveACLs:callback:
 
(void) - saveACLsOnObject:callback:
 
(void) - deleteObject:additionalOptions:callback:
 
(void) - saveFileAtURL:additionalOptions:callback:
 
(void) - saveFileAtURL:named:additionalOptions:callback:
 
(void) - saveUserFileAtURL:additionalOptions:callback:
 
(void) - saveUserFileAtURL:named:additionalOptions:callback:
 
(void) - saveFileWithData:additionalOptions:callback:
 
(void) - saveFileWithData:named:additionalOptions:callback:
 
(void) - saveUserFileWithData:additionalOptions:callback:
 
(void) - saveUserFileWithData:named:additionalOptions:callback:
 
(void) - deleteFileNamed:additionalOptions:callback:
 
(void) - deleteUserFileNamed:additionalOptions:callback:
 
(void) - deleteUserObject:additionalOptions:callback:
 
(void) - deleteACL:callback:
 
(void) - deleteObjects:additionalOptions:callback:
 
(void) - deleteUserObjects:additionalOptions:callback:
 
(void) - deleteACLs:callback:
 
(void) - addObject:
 
(void) - addUserObject:
 
(void) - addACL:
 
(void) - removeObject:
 
(void) - removeUserObject:
 
(void) - removeACL:
 
(void) - addFile:
 
(void) - addUserFile:
 
(void) - removeFile:
 
(void) - removeUserFile:
 
(CMObjectOwnershipLevel- objectOwnershipLevel:
 

Class Methods

(CMStore *) + defaultStore
 
(CMStore *) + store
 
(CMStore *) + storeWithUser:
 

Properties

CMWebServicewebService
 
CMUseruser
 
NSError * lastError
 

Detailed Description

This is the high-level interface for interacting with remote objects stored on CloudMine. Note that all the methods here that involve network operations are asynchronous to avoid blocking your app's UI thread. Synchronous versions will come eventually for cases where you are managing a number of threads and can guarantee that blocking network operations will execute on a background thread.

Most apps will only need one store to store and retrieve remote objects. You can use defaultStore (CMStore) to access this store. It is fully managed for you by the CloudMine SDK.

All of the async methods in this class take a callback of type CMStoreObjectCallback that will be called with all the object instances once they are finished downloading and inflating.

You can subscribe to CMStores using NSNotificationCenter and listening for CMStoreObjectDeletedNotification. It will be triggered when any object managed by the store is deleted. The userInfo dictionary in the NSNotification object passed to your handler will contain a mapping of object IDs to the object instances that were deleted.

Definition at line 65 of file CMStore.h.

Method Documentation

- (void) addACL: (CMACL *)  acl

Adds an ACL to this store. Doing this also sets the ACL's store property to this store. No persistence is performed as a result of calling this method. The store must be configured with a user or else calling this method will throw an exception. This method is thread-safe.

Parameters
aclThe object to add.
Exceptions
NSExceptionAn exception will be raised if this method is called when a user is not configured for this store.
See Also
CMACL
- (void) addFile: (CMFile *)  theFile

Adds an app-level file to this store. Doing this also sets the file's store property to this store. No persistence is performed as a result of calling this method. This method is thread-safe.

Parameters
theFileThe file to add.
See Also
CMObject::store
- (void) addObject: (CMObject *)  theObject

Adds an app-level object to this store. Doing this also sets the object's store property to this store. No persistence is performed as a result of calling this method. This method is thread-safe.

Parameters
theObjectThe object to add.
See Also
CMObject::store
- (void) addUserFile: (CMFile *)  theFile

Adds a user-level file to this store. Doing this also sets the file's store property to this store. No persistence is performed as a result of calling this method. The store must be configured with a user or else calling this method will throw an exception. This method is thread-safe.

Parameters
theFileThe file to add.
Exceptions
NSExceptionAn exception will be raised if this method is called when a user is not configured for this store.
See Also
CMObject::store
- (void) addUserObject: (CMObject *)  theObject

Adds a user-level object to this store. Doing this also sets the object's store property to this store. No persistence is performed as a result of calling this method. The store must be configured with a user or else calling this method will throw an exception. This method is thread-safe.

Parameters
theObjectThe object to add.
Exceptions
NSExceptionAn exception will be raised if this method is called when a user is not configured for this store.
See Also
CMObject::store
- (void) allACLs: (CMStoreACLFetchCallback callback

Downloads all ACLs associated with the store's user

Parameters
callbackThe callback to be triggered when all the ACLs are finished downloading. The store must be configured with a user or else calling this method will throw an exception.
Exceptions
NSExceptionAn exception will be raised if this method is called when a user is not configured for this store.
See Also
CMACL
- (void) allObjectsOfClass: (Class)  klass
additionalOptions: (CMStoreOptions *)  options
callback: (CMStoreObjectFetchCallback callback 

Downloads app-level objects of the given class from your app's CloudMine object store.

Parameters
klassThe class of the objects you want to download. [klass className] is called to determine the remote type.
optionsAdditional options, such as paging and server-side post-processing functions, to apply. This can be nil
callbackThe callback to be triggered when all the objects are finished downloading.>.
Exceptions
NSExceptionAn exception will be raised if klass doesn't respond to className.
See Also
CMStoreOptions
+ className (CMSerializable-p)
- (void) allObjectsWithOptions: (CMStoreOptions *)  options
callback: (CMStoreObjectFetchCallback callback 

Downloads all app-level objects for your app's CloudMine object store.

Parameters
optionsAdditional options, such as paging and server-side post-processing functions, to apply. This can be nil.
callbackThe callback to be triggered when all the objects are finished downloading.
See Also
CMStoreOptions
- (void) allUserObjectsOfClass: (Class)  klass
additionalOptions: (CMStoreOptions *)  options
callback: (CMStoreObjectFetchCallback callback 

Downloads user-level objects of the given class from your app's CloudMine object store. The store must be configured with a user or else calling this method will throw an exception.

Parameters
klassThe class of the objects you want to download. [klass className] is called to determine the remote type.
optionsAdditional options, such as paging and server-side post-processing functions, to apply. This can be nil.
callbackThe callback to be triggered when all the objects are finished downloading.
Exceptions
NSExceptionAn exception will be raised if this method is called when a user is not configured for this store OR if klass doesn't respond to className.
See Also
CMStoreOptions
+ className (CMSerializable-p)
- (void) allUserObjectsWithOptions: (CMStoreOptions *)  options
callback: (CMStoreObjectFetchCallback callback 

Downloads all user-level objects for your app's CloudMine object store. The store must be configured with a user or else calling this method will throw an exception.

Parameters
optionsAdditional options, such as paging and server-side post-processing functions, to apply. This can be nil.
callbackThe callback to be triggered when all the objects are finished downloading.
Exceptions
NSExceptionAn exception will be raised if this method is called when a user is not configured for this store.
See Also
CMStoreOptions
+ (CMStore *) defaultStore

The default store for this app.

Most apps need only a single store. Use this method to access a shared store that you can safely use across your app for storing and retrieving all your model objects. If for some reason you need more than one store in your app, you can use CMStore's constructors as usual.

You must have already initialized the CMAPICredentials singleton with your app identifier and secret key.

Returns
CMStore
See Also
CMAPICredentials
- (void) deleteACL: (CMACL *)  acl
callback: (CMStoreDeleteCallback callback 

Deletes the given ACL from CloudMine's data store and removes the acl from this store. The store must be configured with a user or else calling this method will throw an exception. The ACL will automatically remove references to itself from access fields of the objects it belonged to.

Exceptions
NSExceptionAn exception will be raised if this method is called when a user is not configured for this store.
Parameters
aclThe ACL to delete and remove from the store.
callbackThe callback to be triggered when the acl has been deleted.
- (void) deleteACLs: (NSArray *)  acls
callback: (CMStoreDeleteCallback callback 

Deletes the given ACLs from CloudMine's data store and removes them from this store. The store must be configured with a user or else calling this method will throw an exception. The ACLs will automatically remove references to themselves from access fields of the objects it belonged to.

Exceptions
NSExceptionAn exception will be raised if this method is called when a user is not configured for this store.
Parameters
aclsThe ACLs to delete and remove from the store.
callbackThe callback to be triggered when the acl has been deleted.
- (void) deleteFileNamed: (NSString *)  name
additionalOptions: (CMStoreOptions *)  options
callback: (CMStoreDeleteCallback callback 

Deletes the given app-level file from your app's CloudMine data store.

Parameters
nameThe name of the file to delete.
optionsAdditional options, such as paging and server-side post-processing functions, to apply. This can be nil.
callbackThe callback to be triggered when the file has been deleted.
See Also
https://cloudmine.me/docs/ios/reference#app_files
- (void) deleteObject: (id< CMSerializable >)  theObject
additionalOptions: (CMStoreOptions *)  options
callback: (CMStoreDeleteCallback callback 

Deletes the given app-level object from your app's CloudMine data store and removes the object from this store. This also triggers a notification of type CMStoreObjectDeletedNotification to subscribers of the store so you can do any other necessary cleanup throughout your app. This notification is triggered before the object is deleted from the server.

Parameters
theObjectThe object to delete and remove from the store.
optionsAdditional options, such as paging and server-side post-processing functions, to apply. This can be nil.
callbackThe callback to be triggered after the object has been deleted.
- (void) deleteObjects: (NSArray *)  objects
additionalOptions: (CMStoreOptions *)  options
callback: (CMStoreDeleteCallback callback 

Deletes all the given app-level objects from your app's CloudMine data store and removes the object from this store. This also triggers a notification of type CMStoreObjectDeletedNotification to subscribers of the store so you can do any other necessary cleanup throughout your app. This notification is triggered before the objects are deleted from the server.

Parameters
objectsThe objects to delete and remove from the store.
optionsAdditional options, such as paging and server-side post-processing functions, to apply. This can be nil.
callbackThe callback to be triggered when the objects have been deleted.
- (void) deleteUserFileNamed: (NSString *)  name
additionalOptions: (CMStoreOptions *)  options
callback: (CMStoreDeleteCallback callback 

Deletes the given user-level file from your app's CloudMine data store. The store must be configured with a user or else calling this method will throw an exception.

Parameters
nameThe name of the file to delete.
optionsAdditional options, such as paging and server-side post-processing functions, to apply. This can be nil.
callbackThe callback to be triggered when the file has been deleted.
Exceptions
NSExceptionAn exception will be raised if this method is called when a user is not configured for this store.
See Also
https://cloudmine.me/docs/ios/reference#app_files
- (void) deleteUserObject: (id< CMSerializable >)  theObject
additionalOptions: (CMStoreOptions *)  options
callback: (CMStoreDeleteCallback callback 

Deletes the given user-level object from your app's CloudMine data store and removes the object from this store. The store must be configured with a user or else calling this method will throw an exception. This also triggers a notification of type CMStoreObjectDeletedNotification to subscribers of the store so you can do any other necessary cleanup throughout your app. This notification is triggered before the object is deleted from the server.

Parameters
theObjectThe object to delete and remove from the store.
optionsAdditional options, such as paging and server-side post-processing functions, to apply. This can be nil.
callbackThe callback to be triggered when the object has been deleted.
- (void) deleteUserObjects: (NSArray *)  objects
additionalOptions: (CMStoreOptions *)  options
callback: (CMStoreDeleteCallback callback 

Deletes all the given user-level objects from your app's CloudMine data store and removes the object from this store. The store must be configured with a user or else calling this method will throw an exception. This also triggers a notification of type CMStoreObjectDeletedNotification to subscribers of the store so you can do any other necessary cleanup throughout your app. This notification is triggered before the objects are deleted from the server.

Parameters
objectsThe objects to delete and remove from the store.
optionsAdditional options, such as paging and server-side post-processing functions, to apply. This can be nil.
callbackThe callback to be triggered when the objects has been deleted.
- (void) fileWithName: (NSString *)  name
additionalOptions: (CMStoreOptions *)  options
callback: (CMStoreFileFetchCallback callback 

Downloads an app-level binary file from your app's CloudMine data store.

Parameters
callbackThe callback to be triggered when the file is finished downloading.
optionsAdditional options, such as paging and server-side post-processing functions, to apply. This can be nil.
nameThe unique name of the file to download.
See Also
https://cloudmine.me/docs/ios/reference#app_files
- (id) init

Default constructor. Note that you must have already initialized the CMAPICredentials singleton with your app identifier and secret key. Using this method will not tie this store to any particular user, and all objects you retrieve and upload will be app-level.

See Also
CMAPICredentials
- (id) initWithUser: (CMUser *)  theUser

Constructor that configures this store with a user. Note that you must have already initialized the CMAPICredentials singleton with your app identifier and secret key.

Parameters
theUserThe user to configure the store with.
See Also
CMAPICredentials
CMUser
- (CMObjectOwnershipLevel) objectOwnershipLevel: (id)  theObject
Parameters
theObjectAn instance of CMObject or CMFile.
Returns
The ownership level of the object or file given.
See Also
CMObjectOwnershipLevel
- (void) objectsWithKeys: (NSArray *)  keys
additionalOptions: (CMStoreOptions *)  options
callback: (CMStoreObjectFetchCallback callback 

Downloads app-level objects for your app's CloudMine object store with the given keys.

Parameters
keysThe keys of the objects you wish to download. Specifying a key for an object that does not exist will not cause an error.
optionsAdditional options, such as paging and server-side post-processing functions, to apply. This can be nil.
callbackThe callback to be triggered when all the objects are finished downloading.
See Also
CMStoreOptions
- (void) registerForPushNotifications: (UIRemoteNotificationType)  notificationType
callback: (CMWebServiceDeviceTokenCallback callback 

Registers your application for push notifications. This method will contact Apple, request a token, handle the token and register your application with CloudMine. After the token has been sent to Cloudmine, the callback with the result will be given.

Note - This method will register the stored CMUser to the token. If you do not want to associate the token with the user use registerForPushNotifications:user:callback: and pass nil.

Parameters
notificationTypeThe parameter of this method takes a UIRemoteNotificationType bit mask that specifies the initial types of notifications that the application wishes to receive. For example, (UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound)
callbackCan be nil - The callback which is called once the Token has been sent to Cloudmine, returns the result of that transaction.
- (void) registerForPushNotifications: (UIRemoteNotificationType)  notificationType
user: (CMUser *)  aUser
callback: (CMWebServiceDeviceTokenCallback callback 

Registers your application for push notifications. This method will contact Apple, request a token, handle the token and register your application with CloudMine. After the token has been sent to Cloudmine, the callback with the result will be given.

Parameters
notificationTypeThe parameter of this method takes a UIRemoteNotificationType bit mask that specifies the initial types of notifications that the application wishes to receive. For example, (UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound)
userCan be nil. The user you want to associate the token with.
callbackCan be nil - The callback which is called once the Token has been sent to Cloudmine, returns the result of that transaction.
- (void) removeACL: (CMACL *)  acl

Removes an ACL from this store. The store must be configured with a user or else calling this method will throw an exception. Doing this also nullifies the object's store property. No persistence is performed as a result of calling this method. This method is thread-safe.

Parameters
aclThe object to remove.
See Also
CMACL
- (void) removeFile: (CMFile *)  theFile

Removes an app-level file from this store. Doing this also nullifies the file's store property. No persistence is performed as a result of calling this method. This method is thread-safe.

Parameters
theFileThe file to remove.
See Also
CMObject::store
- (void) removeObject: (CMObject *)  theObject

Removes an app-level object from this store. Doing this also nullifies the object's store property. No persistence is performed as a result of calling this method. This method is thread-safe.

Parameters
theObjectThe object to remove.
See Also
CMObject::store
- (void) removeUserFile: (CMFile *)  theFile

Removes a user-level file from this store. The store must be configured with a user or else calling this method will throw an exception. Doing this also nullifies the file's store property. No persistence is performed as a result of calling this method. This method is thread-safe.

Parameters
theFileThe file to remove.
See Also
CMObject::store
- (void) removeUserObject: (CMObject *)  theObject

Removes a user-level object from this store. The store must be configured with a user or else calling this method will throw an exception. Doing this also nullifies the object's store property. No persistence is performed as a result of calling this method. This method is thread-safe.

Parameters
theObjectThe object to remove.
See Also
CMObject::store
- (void) saveACL: (CMACL *)  acl
callback: (CMStoreObjectUploadCallback callback 

Saves an individual ACL to CloudMine's data store. The store must be configured with a user or else calling this method will throw an exception. If this ACL doesn't already belong to this store, it will automatically be added as well. This has the additional effect of increasing the ACL's retain count by 1 as well as setting its store property to this store.

Parameters
aclThe ACL to save.
callbackThe callback to be triggered when all the ACLs are finished uploading.
Exceptions
NSExceptionAn exception will be raised if this method is called when a user is not configured for this store.
See Also
CMACL
- (void) saveACLs: (NSArray *)  acls
callback: (CMStoreObjectUploadCallback callback 

Saves an array of ACLs to CloudMine's data store. The store must be configured with a user or else calling this method will throw an exception. If the ACLs doesn't already belong to this store, it will automatically be added as well. This has the additional effect of increasing the ACLs' retain counts by 1 as well as setting their store property to this store.

Parameters
aclsThe ACLs to save.
callbackThe callback to be triggered when all the ACLs are finished uploading.
Exceptions
NSExceptionAn exception will be raised if this method is called when a user is not configured for this store.
See Also
CMACL
- (void) saveACLsOnObject: (CMObject *)  object
callback: (CMStoreObjectUploadCallback callback 

Saves all the ACLs in the store that are associated to the given object. The store must be configured with a user or else calling this method will throw an exception. If the ACLs doesn't already belong to this store, it will automatically be added as well. This has the additional effect of increasing the ACLs' retain counts by 1 as well as setting their store property to this store.

Parameters
objectThe object whose ACLs will be saved
callbackThe callback to be triggered when all the ACLs are finished uploading.
Exceptions
NSExceptionAn exception will be raised if this method is called when a user is not configured for this store.
See Also
CMACL
- (void) saveAll: (CMStoreObjectUploadCallback callback

Saves all the objects (user- and app-level) in the store with your app's CloudMine data store. User-level objects will only be sync'd if there is a user associated with this store.

Parameters
callbackThe callback to be triggered when all the objects are finished uploading.
- (void) saveAllACLs: (CMStoreObjectUploadCallback callback

Saves all the ACLs in the local store to CloudMine. The store must be configured with a user or else calling this method will throw an exception.

Parameters
callbackThe callback to be triggered when all the ACLs are finished uploading.
Exceptions
NSExceptionAn exception will be raised if this method is called when a user is not configured for this store.
See Also
CMACL
- (void) saveAllAppObjects: (CMStoreObjectUploadCallback callback

Saves all the app-level objects in the store to your app's CloudMine data store.

Parameters
callbackThe callback to be triggered when all the objects are finished uploading.
- (void) saveAllAppObjectsWithOptions: (CMStoreOptions *)  options
callback: (CMStoreObjectUploadCallback callback 

Saves all the app-level objects in the store to your app's CloudMine data store.

Parameters
optionsUse these options to specify a server-side function to call after persisting the objects. Only CMStoreOptions::serverSideFunction is used.
callbackThe callback to be triggered when all the objects are finished uploading.
- (void) saveAllUserObjects: (CMStoreObjectUploadCallback callback

Saves all the user-objects in the store to your app's CloudMine data store. The store must be configured with a user or else calling this method will throw an exception.

Parameters
callbackThe callback to be triggered when all the objects are finished uploading.
Exceptions
NSExceptionAn exception will be raised if this method is called when a user is not configured for this store.
- (void) saveAllUserObjectsWithOptions: (CMStoreOptions *)  options
callback: (CMStoreObjectUploadCallback callback 

Saves all the user-objects in the store to your app's CloudMine data store. The store must be configured with a user or else calling this method will throw an exception.

Parameters
optionsUse these options to specify a server-side function to call after persisting the objects. Only CMStoreOptions::serverSideFunction is used.
callbackThe callback to be triggered when all the objects are finished uploading.
Exceptions
NSExceptionAn exception will be raised if this method is called when a user is not configured for this store.
- (void) saveAllWithOptions: (CMStoreOptions *)  options
callback: (CMStoreObjectUploadCallback callback 

Saves all the objects (user- and app-level) in the store with your app's CloudMine data store. User-level objects will only be sync'd if there is a user associated with this store.

Parameters
optionsUse these options to specify a server-side function to call after persisting the objects. Only CMStoreOptions::serverSideFunction is used.
callbackThe callback to be triggered when all the objects are finished uploading.
- (void) saveFileAtURL: (NSURL *)  url
additionalOptions: (CMStoreOptions *)  options
callback: (CMStoreFileUploadCallback callback 

Saves a file to your app's CloudMine data store at the app-level. This works by streaming the contents of the file directly from the filesystem, thus never loading the file into memory. The server will generate a name for this file, which will be passed into the given callback.

Parameters
urlThe absolute URL to the location of the file on the device.
optionsAdditional options, such as paging and server-side post-processing functions, to apply. This can be nil.
callbackThe callback to be triggered when the file is finished uploading.
See Also
https://cloudmine.me/docs/ios/reference#app_files
- (void) saveFileAtURL: (NSURL *)  url
named: (NSString *)  name
additionalOptions: (CMStoreOptions *)  options
callback: (CMStoreFileUploadCallback callback 

Saves a file to your app's CloudMine data store at the app-level. This works by streaming the contents of the file directly from the filesystem, thus never loading the file into memory. You must give the file a name that is unique within your app's data store.

Parameters
urlThe absolute URL to the location of the file on the device.
nameThe name to give the file on CloudMine. This must be unique throughout all instances of your app.
optionsAdditional options, such as paging and server-side post-processing functions, to apply. This can be nil.
callbackThe callback to be triggered when the file is finished uploading.
See Also
https://cloudmine.me/docs/ios/reference#app_files
- (void) saveFileWithData: (NSData *)  data
additionalOptions: (CMStoreOptions *)  options
callback: (CMStoreFileUploadCallback callback 

Saves a file to your app's CloudMine data store at the app-level. This uses the raw data of the file's contents contained in an NSData object. The server will generate a name for this file, which will be passed into the given callback.

Parameters
dataThe raw contents of the file.
optionsAdditional options, such as paging and server-side post-processing functions, to apply. This can be nil.
callbackThe callback to be triggered when the file is finished uploading.
See Also
https://cloudmine.me/docs/ios/reference#app_files
- (void) saveFileWithData: (NSData *)  data
named: (NSString *)  name
additionalOptions: (CMStoreOptions *)  options
callback: (CMStoreFileUploadCallback callback 

Saves a file to your app's CloudMine data store at the app-level. This uses the raw data of the file's contents contained in an NSData object. You must give the file a name that is unique within your app's data store.

Parameters
dataThe raw contents of the file.
nameThe name to give the file on CloudMine. This must be unique throughout all instances of your app.
optionsAdditional options, such as paging and server-side post-processing functions, to apply. This can be nil.
callbackThe callback to be triggered when the file is finished uploading.
See Also
https://cloudmine.me/docs/ios/reference#app_files
- (void) saveObject: (CMObject *)  theObject
additionalOptions: (CMStoreOptions *)  options
callback: (CMStoreObjectUploadCallback callback 

Saves an individual object to your app's CloudMine data store at the app-level. If this object doesn't already belong to this store, it will automatically be added as well. This has the additional effect of increasing the object's retain count by 1 as well as setting its store property to this store.

Parameters
theObjectThe object to save.
optionsUse these options to specify a server-side function to call after persisting the objects. Only CMStoreOptions::serverSideFunction is used.
callbackThe callback to be triggered when all the objects are finished uploading.
See Also
CMObject::store
- (void) saveObject: (CMObject *)  theObject
callback: (CMStoreObjectUploadCallback callback 

Saves an individual object to your app's CloudMine data store at the app-level. If this object doesn't already belong to this store, it will automatically be added as well. This has the additional effect of increasing the object's retain count by 1 as well as setting its store property to this store.

Parameters
theObjectThe object to save.
callbackThe callback to be triggered when all the objects are finished uploading.
See Also
CMObject::store
- (void) saveUserFileAtURL: (NSURL *)  url
additionalOptions: (CMStoreOptions *)  options
callback: (CMStoreFileUploadCallback callback 

Saves a file to your app's CloudMine data store at the user-level. The store must be configured with a user or else calling this method will throw an exception. This works by streaming the contents of the file directly from the filesystem, thus never loading the file into memory. The server will generate a name for this file, which will be passed into the given callback.

Parameters
urlThe absolute URL to the location of the file on the device.
optionsAdditional options, such as paging and server-side post-processing functions, to apply. This can be nil.
callbackThe callback to be triggered when the file is finished uploading.
Exceptions
NSExceptionAn exception will be raised if this method is called when a user is not configured for this store.
See Also
https://cloudmine.me/docs/ios/reference#app_files
- (void) saveUserFileAtURL: (NSURL *)  url
named: (NSString *)  name
additionalOptions: (CMStoreOptions *)  options
callback: (CMStoreFileUploadCallback callback 

Saves a file to your app's CloudMine data store at the user-level. The store must be configured with a user or else calling this method will throw an exception. This works by streaming the contents of the file directly from the filesystem, thus never loading the file into memory. You must give the file a name that is unique within your app's data store.

Parameters
urlThe absolute URL to the location of the file on the device.
nameThe name to give the file on CloudMine. This must be unique throughout all instances of your app.
optionsAdditional options, such as paging and server-side post-processing functions, to apply. This can be nil.
callbackThe callback to be triggered when the file is finished uploading.
Exceptions
NSExceptionAn exception will be raised if this method is called when a user is not configured for this store.
See Also
https://cloudmine.me/docs/ios/reference#app_files
- (void) saveUserFileWithData: (NSData *)  data
additionalOptions: (CMStoreOptions *)  options
callback: (CMStoreFileUploadCallback callback 

Saves a file to your app's CloudMine data store at the user-level. The store must be configured with a user or else calling this method will throw an exception. This uses the raw data of the file's contents contained in an NSData object. The server will generate a name for this file, which will be passed into the given callback.

Parameters
dataThe raw contents of the file.
optionsAdditional options, such as paging and server-side post-processing functions, to apply. This can be nil.
callbackThe callback to be triggered when the file is finished uploading.
Exceptions
NSExceptionAn exception will be raised if this method is called when a user is not configured for this store.
See Also
https://cloudmine.me/docs/ios/reference#app_files
- (void) saveUserFileWithData: (NSData *)  data
named: (NSString *)  name
additionalOptions: (CMStoreOptions *)  options
callback: (CMStoreFileUploadCallback callback 

Saves a file to your app's CloudMine data store at the user-level. The store must be configured with a user or else calling this method will throw an exception. This uses the raw data of the file's contents contained in an NSData object. You must give the file a name that is unique within your app's data store.

Parameters
dataThe raw contents of the file.
nameThe name to give the file on CloudMine. This must be unique throughout all instances of your app.
optionsAdditional options, such as paging and server-side post-processing functions, to apply. This can be nil.
callbackThe callback to be triggered when the file is finished uploading.
Exceptions
NSExceptionAn exception will be raised if this method is called when a user is not configured for this store.
See Also
https://cloudmine.me/docs/ios/reference#app_files
- (void) saveUserObject: (CMObject *)  theObject
additionalOptions: (CMStoreOptions *)  options
callback: (CMStoreObjectUploadCallback callback 

Saves an individual object to your app's CloudMine data store at the user-level. The store must be configured with a user or else calling this method will throw an exception. If this object doesn't already belong to this store, it will automatically be added as well. This has the additional effect of increasing the object's retain count by 1 as well as setting its store property to this store.

Parameters
theObjectThe object to save.
optionsUse these options to specify a server-side function to call after persisting the objects. Only CMStoreOptions::serverSideFunction is used.
callbackThe callback to be triggered when all the objects are finished uploading.
Exceptions
NSExceptionAn exception will be raised if this method is called when a user is not configured for this store.
See Also
CMObject::store
- (void) saveUserObject: (CMObject *)  theObject
callback: (CMStoreObjectUploadCallback callback 

Saves an individual object to your app's CloudMine data store at the user-level. The store must be configured with a user or else calling this method will throw an exception. If this object doesn't already belong to this store, it will automatically be added as well. This has the additional effect of increasing the object's retain count by 1 as well as setting its store property to this store.

Parameters
theObjectThe object to save.
callbackThe callback to be triggered when all the objects are finished uploading.
Exceptions
NSExceptionAn exception will be raised if this method is called when a user is not configured for this store.
See Also
CMObject::store
- (void) searchACLs: (NSString *)  query
callback: (CMStoreACLFetchCallback callback 

Performs a search across all ACLs owned by the user of the store The store must be configured with a user or else calling this method will throw an exception.

Parameters
queryThe search query to perform. This must conform to the syntax outlined in the CloudMine documentation.
callbackThe callback to be triggered when all the ACLs are finished downloading.
Exceptions
NSExceptionAn exception will be raised if this method is called when a user is not configured for this store.
See Also
CMACL
https://cloudmine.me/docs/api#query_syntax
- (void) searchObjects: (NSString *)  query
additionalOptions: (CMStoreOptions *)  options
callback: (CMStoreObjectFetchCallback callback 

Performs a search across all app-level objects in your app's CloudMine object store.

Parameters
queryThe search query to perform. This must conform to the syntax outlined in the CloudMine documentation.
optionsAdditional options, such as paging and server-side post-processing functions, to apply. This can be nil.
callbackThe callback to be triggered when all the objects are finished downloading.
See Also
CMStoreOptions
https://cloudmine.me/docs/api#query_syntax
- (void) searchUserObjects: (NSString *)  query
additionalOptions: (CMStoreOptions *)  options
callback: (CMStoreObjectFetchCallback callback 

Performs a search across all user-level objects in your app's CloudMine object store. The store must be configured with a user or else calling this method will throw an exception.

Parameters
queryThe search query to perform. This must conform to the syntax outlined in the CloudMine documentation.
optionsAdditional options, such as paging and server-side post-processing functions, to apply. This can be nil.
callbackThe callback to be triggered when all the objects are finished downloading.
Exceptions
NSExceptionAn exception will be raised if this method is called when a user is not configured for this store.
See Also
CMStoreOptions
https://cloudmine.me/docs/api#query_syntax
+ (CMStore *) store

Convenience method to return a newly initialized CMStore instance. Note that, like when using init, you must have already initialized the CMAPICredentials singleton with your app identifier and secret key.

See Also
CMAPICredentials
+ (CMStore *) storeWithUser: (CMUser *)  theUser

Convenience method to return a newly initialized CMStore instance. Note that, like when using initWithUser:, you must have already initialized the CMAPICredentials singleton with your app identifier and secret key.

Parameters
theUserThe user to configure the store with.
See Also
CMAPICredentials
CMUser
- (void) unRegisterForPushNotificationsWithCallback: (CMWebServiceDeviceTokenCallback callback

Unregisters the users token from CloudMine, so they will no longer receive push notifications. Recommended to remove the token when the user logs out of the app, but not required.

Parameters
callbackCan be nil - The callback which is called once the Token has been removed fromCloudmine, returns the result of that transaction.
- (void) userFileWithName: (NSString *)  name
additionalOptions: (CMStoreOptions *)  options
callback: (CMStoreFileFetchCallback callback 

Downloads a user-level binary file from your app's CloudMine data store. The store must be configured with a user or else calling this method will throw an exception.

Parameters
callbackThe callback to be triggered when the file is finished downloading.
optionsAdditional options, such as paging and server-side post-processing functions, to apply. This can be nil.
nameThe unique name of the file to download.
Exceptions
NSExceptionAn exception will be raised if this method is called when a user is not configured for this store.
See Also
https://cloudmine.me/docs/ios/reference#app_files
- (void) userObjectsWithKeys: (NSArray *)  keys
additionalOptions: (CMStoreOptions *)  options
callback: (CMStoreObjectFetchCallback callback 

Downloads user-level objects for your app's CloudMine object store with the given keys. The store must be configured with a user or else calling this method will throw an exception.

Parameters
keysThe keys of the objects you wish to download. Specifying a key for an object that does not exist will not cause an error.
optionsAdditional options, such as paging and server-side post-processing functions, to apply. This can be nil.
callbackThe callback to be triggered when all the objects are finished downloading.
Exceptions
NSExceptionAn exception will be raised if this method is called when a user is not configured for this store.
See Also
CMStoreOptions

Property Documentation

- (NSError*) lastError
readatomicstrong

The last error that occured during a store-based operation.

Definition at line 85 of file CMStore.h.

- (CMUser*) user
readwritenonatomicstrong

The user to be used when accessing user-level objects. This is ignored for app-level objects.

Note: Changing this from one user to another will cause all the cached objects associated with the first user to be removed. This won't have any affect on the objects if you have retained references to them elsewhere, but it will have the effect of nullifying the store reference in all those objects. This is because since you have changed the store's user ownership to User 2, the first set of objects (which belong to User 1) no longer belong to the store. This operation is thread-safe.

See Also
CMObject::store

Definition at line 82 of file CMStore.h.

- (CMWebService*) webService
readwritenonatomicstrong

The CMWebService instance that backs this store

Definition at line 68 of file CMStore.h.


The documentation for this class was generated from the following file: