Inherits from NMCore : NSObject
Declared in NMContent.h
NMContent.m

Overview

The NMContent class is used to run CRUD (Create, Update and Delete) operations over the data. Fields on NMContent objects can be instances of certain classes. While creating or updating your contents, you should beware of class limitations. The objects created by this class are stored over cloud. Whenever you need your content data, you can access them easily over cloud.

Tasks

Other Methods

  •   __deprecated

    Identifier of the NMContent object.

    property
  •   identifier

    Identifier of the NMContent object.

    property
  •   path

    Path of the NMContent object.

    property
  •   createDate

    Create date of the NMContent object.

    property
  •   updateDate

    Update date of the NMContent object.

    property
  •   privacy

    Privacy of the NMContent object.

    property
  • – initWithObjectName:

    Initializes the newly allocated NMContent object with the specified identifier value.

  • – initWithIdentifier:

    Initializes the newly allocated NMContent object with the specified identifier value.

  • – create:

    Creates a content that contains JSON-compatible key-value pairs over cloud. Since these contents have shameless structure, you can set whatever key-value pairs you want by the condition that keys should be alphanumeric strings and values should be JSON-encoded objects.

  • – createWithError:

    Creates a content that contains JSON-compatible key-value pairs over cloud. Since these contents have shameless structure, you can set whatever key-value pairs you want by the condition that keys should be alphanumeric strings and values should be JSON-encoded objects.

  • – createInBackgroundWithCompletionHandler:

    Creates a content that contains JSON-compatible key-value pairs over cloud on background thread and executes the given handler block at the completion of running method. Since these contents have shameless structure, you can set whatever key-value pairs you want by the condition that keys should be alphanumeric strings and values should be JSON-encoded objects.

  • – update:

    Updates a content that contains JSON-compatible key-value pairs over cloud. After adding needful key-value pairs, call this method over receiver.

  • – updateWithError:

    Updates a content that contains JSON-compatible key-value pairs over cloud. After adding needful key-value pairs, call this method over receiver.

  • – updateInBackgroundWithCompletionHandler:

    Updates a content that contains JSON-compatible key-value pairs over cloud on background thread and executes the given handler block at the completion of running method. After adding needful key-value pairs, call this method over receiver.

  • – delete:

    Removes the receiver content from cloud.

  • – deleteWithError:

    Removes the receiver content from cloud.

  • – deleteInBackgroundWithCompletionHandler:

    Removes the receiver content from cloud on the background thread and executes the given handler block at the completion of running method.

  • – add:object:

    Adds JSON-compatible key-value pairs into the object. If the object contains the given key, the old value is replaced with the new ones.

  • – setObject:forKey:

    Adds JSON-compatible key-value pairs into the object. If the object contains the given key, the old value is replaced with the new ones.

  • – addBool:object:

    Adds JSON-compatible key-value pairs into the object. If the object contains the given key, the old value is replaced with the new ones. Value is a BOOL type.

  • – setBool:forKey:

    Adds JSON-compatible key-value pairs into the object. If the object contains the given key, the old value is replaced with the new ones. Value is a BOOL type.

  • – incrementByValue:forKey:

    Increases/decreases a field of a content by the given value on create or update operation. If the value is a positive number, the field is increased, otherwise it is decreased.

  • – objectForKey:

    Returns the object associated with the given key.

  • – get:

    Returns the object associated with the given key.

  • – getString:

    Returns the NSString object associated with the given key.

  • – getInt:

    Returns the integer value associated with the given key.

  • – getLong:

    Returns the long value associated with the given key.

  • – getBool:

    Returns the boolean value associated with the given key.

  • – boolForKey:

    Returns the boolean value associated with the given key.

  • – getDouble:

    Returns the double value associated with the given key.

  • – getDictionary:

    Returns the NSDictionary object associated with the given key.

  • – getArray:

    Returns the NSArray object associated with the given key.

  • – getDate:

    Returns the NSDate object associated with the given key.

  • – dateForKey:

    Returns the NSDate object associated with the given key.

  • – getLocation:

    Returns the NMGeolocation object associated with the given key.

  • – locationForKey:

    Returns the NMGeolocation object associated with the given key.

  • – getUser:

    Returns the NMUser object associated with the given key.

  • – userForKey:

    Returns the NMUser object associated with the given key.

  • – setOwner:

    Sets the owner of this content. This provides that the receiver NMContent object is private for just the owner.

Other Methods

Properties

__deprecated

Identifier of the NMContent object.

@property (nonatomic, strong) NSString *__deprecated

Discussion

Identifier of the NMContent object.

This value represents the contents which have the same fields. You can think this string value as the name of the table in the relational databases.

Declared In

NMContent.h

createDate

Create date of the NMContent object.

@property (nonatomic, readonly, strong) NSString *createDate

Discussion

Create date of the NMContent object.

This value is generated by Netmera automatically in the creation process of any NMContent object. You do NOT have to set this value by creating your content. After creation, String representation of creation date of your content is set automatically.

Declared In

NMContent.h

identifier

Identifier of the NMContent object.

@property (nonatomic, strong) NSString *identifier

Discussion

Identifier of the NMContent object.

This value represents the contents which have the same fields. You can think this string value as the name of the table in the relational databases.

Declared In

NMContent.h

path

Path of the NMContent object.

@property (nonatomic, strong) NSString *path

Discussion

Path of the NMContent object.

This value is generated by Netmera automatically in the creation process of any NMContent object. Every content has unique path throuhout the application. You do NOT have to set this value by creationg your content. After creation, path string is set over your content automatically.

Declared In

NMContent.h

privacy

Privacy of the NMContent object.

@property (nonatomic, assign) NMPrivacy privacy

Discussion

Privacy of the NMContent object.

This value is used to determine the accessibility of the NMContent object.

Warning: Available enum options for privacy:

NMPrivacyPublic, permits all users to access content.

NMPrivacyPrivate, permits only admin and the user, which possesses the content to access it.

Declared In

NMContent.h

updateDate

Update date of the NMContent object.

@property (nonatomic, readonly, strong) NSString *updateDate

Discussion

Update date of the NMContent object.

This value is generated by Netmera automatically in every update process of any NMContent object. You do NOT have to set this value by updating your content. After update operation, String representation of update date of your content is set automatically.

Declared In

NMContent.h

Instance Methods

add:object:

Adds JSON-compatible key-value pairs into the object. If the object contains the given key, the old value is replaced with the new ones.

- (void)add:(NSString *)key object:(NSObject *)value

Parameters

key

Alphanumeric string that represents the key value.

value

Object value associated with the specified key. This value can be an instance of the below classes:

NSString, NSNumber, NSDate, NSData, NSDictionary (members must be one of the mentioned class instances), NSArray (members must be one of the above instance), NMGeolocation, NMUser.

Discussion

Adds JSON-compatible key-value pairs into the object. If the object contains the given key, the old value is replaced with the new ones.

Warning: Raises an exception if value is not an object that NSDictionary accepts or the value is not a JSON-compatible object.

Declared In

NMContent.h

addBool:object:

Adds JSON-compatible key-value pairs into the object. If the object contains the given key, the old value is replaced with the new ones. Value is a BOOL type.

- (void)addBool:(NSString *)key object:(BOOL)value

Parameters

key

Alphanumeric string that represents the key value.

value

BOOL value associated with the specified key.

Discussion

Adds JSON-compatible key-value pairs into the object. If the object contains the given key, the old value is replaced with the new ones. Value is a BOOL type.

Warning: Raises an exception if value is not an object that NSDictionary accepts or the value is not a JSON-compatible object.s

Declared In

NMContent.h

boolForKey:

Returns the boolean value associated with the given key.

- (BOOL)boolForKey:(NSString *)key

Parameters

key

Alphanumeric string that corresponds the requested object.

Return Value

The boolean value for the specified key. Returns NSNotFound if key-value pairs does not exist in the content object.

Discussion

Returns the boolean value associated with the given key.

Declared In

NMContent.h

create:

Creates a content that contains JSON-compatible key-value pairs over cloud. Since these contents have shameless structure, you can set whatever key-value pairs you want by the condition that keys should be alphanumeric strings and values should be JSON-encoded objects.

- (BOOL)create:(NSError **)error

Parameters

error

On input, a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify nil for this parameter if you do not want the error information.

Return Value

YES if the content is created successfully. Returns NO if an error occured.

Discussion

Creates a content that contains JSON-compatible key-value pairs over cloud. Since these contents have shameless structure, you can set whatever key-value pairs you want by the condition that keys should be alphanumeric strings and values should be JSON-encoded objects.

Declared In

NMContent.h

createInBackgroundWithCompletionHandler:

Creates a content that contains JSON-compatible key-value pairs over cloud on background thread and executes the given handler block at the completion of running method. Since these contents have shameless structure, you can set whatever key-value pairs you want by the condition that keys should be alphanumeric strings and values should be JSON-encoded objects.

- (void)createInBackgroundWithCompletionHandler:(NMContentResponseHandler)handler

Parameters

handler

The block to execute when the creation of the content is completed.

Discussion

Creates a content that contains JSON-compatible key-value pairs over cloud on background thread and executes the given handler block at the completion of running method. Since these contents have shameless structure, you can set whatever key-value pairs you want by the condition that keys should be alphanumeric strings and values should be JSON-encoded objects.

As background methods does not block your main thread, it is recommended to use createInBackgroundWithCompletionHandler: over createWithError: or create:.

Declared In

NMContent.h

createWithError:

Creates a content that contains JSON-compatible key-value pairs over cloud. Since these contents have shameless structure, you can set whatever key-value pairs you want by the condition that keys should be alphanumeric strings and values should be JSON-encoded objects.

- (BOOL)createWithError:(NSError **)error

Parameters

error

On input, a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify nil for this parameter if you do not want the error information.

Return Value

YES if the content is created successfully. Returns NO if an error occurs.

Discussion

Creates a content that contains JSON-compatible key-value pairs over cloud. Since these contents have shameless structure, you can set whatever key-value pairs you want by the condition that keys should be alphanumeric strings and values should be JSON-encoded objects.

Declared In

NMContent.h

dateForKey:

Returns the NSDate object associated with the given key.

- (NSDate *)dateForKey:(NSString *)key

Parameters

key

Alphanumeric string that corresponds the requested object.

Return Value

The NSDate object for the specified key. Returns nil if key-value pairs does not exist in the content object.

Discussion

Returns the NSDate object associated with the given key.

Declared In

NMContent.h

delete:

Removes the receiver content from cloud.

- (BOOL)delete:(NSError **)error

Parameters

On

input, a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify nil for this parameter if you do not want the error information.

Return Value

YES if the content is deleted successfully. Returns NO if an error occurs.

Discussion

Removes the receiver content from cloud.

Warning: In order to delete a content, you should be sure that you set its path correctly or directly call this method on fetched content.

Declared In

NMContent.h

deleteInBackgroundWithCompletionHandler:

Removes the receiver content from cloud on the background thread and executes the given handler block at the completion of running method.

- (void)deleteInBackgroundWithCompletionHandler:(void ( ^ ) ( NSError *error ))handler

Parameters

handler

The block to execute when delete of the content is completed.

Discussion

Removes the receiver content from cloud on the background thread and executes the given handler block at the completion of running method.

Warning: In order to delete a content, you should be sure that you set its path correctly or directly call this method on fetched content.

As background methods does not block your main thread, it is recommended to use deleteInBackgroundWithCompletionHandler: over deleteWithError: or delete:.

Declared In

NMContent.h

deleteWithError:

Removes the receiver content from cloud.

- (BOOL)deleteWithError:(NSError **)error

Parameters

On

input, a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify nil for this parameter if you do not want the error information.

Return Value

YES if the content is deleted successfully. Returns NO if an error occurs.

Discussion

Removes the receiver content from cloud.

Warning: In order to delete a content, you should be sure that you set its path correctly or directly call this method on fetched content.

Declared In

NMContent.h

get:

Returns the object associated with the given key.

- (NSObject *)get:(NSString *)key

Parameters

key

Alphanumeric string that corresponds the requested object.

Return Value

The object for the specified key. Returns nil if key-value pairs does not exist in the content object.

Discussion

Returns the object associated with the given key.

Declared In

NMContent.h

getArray:

Returns the NSArray object associated with the given key.

- (NSArray *)getArray:(NSString *)key

Parameters

key

Alphanumeric string that corresponds the requested object.

Return Value

The NSArray object for the specified key. Returns nil if key-value pairs does not exist in the content object.

Discussion

Returns the NSArray object associated with the given key.

Declared In

NMContent.h

getBool:

Returns the boolean value associated with the given key.

- (BOOL)getBool:(NSString *)key

Parameters

key

Alphanumeric string that corresponds the requested object.

Return Value

The long value for the specified key. Returns NSNotFound if key-value pairs does not exist in the content object.

Discussion

Returns the boolean value associated with the given key.

Declared In

NMContent.h

getDate:

Returns the NSDate object associated with the given key.

- (NSDate *)getDate:(NSString *)key

Parameters

key

Alphanumeric string that corresponds the requested object.

Return Value

The NSDate object for the specified key. Returns nil if key-value pairs does not exist in the content object.

Discussion

Returns the NSDate object associated with the given key.

Declared In

NMContent.h

getDictionary:

Returns the NSDictionary object associated with the given key.

- (NSDictionary *)getDictionary:(NSString *)key

Parameters

key

Alphanumeric string that corresponds the requested object.

Return Value

The NSDictionary object for the specified key. Returns nil if key-value pairs does not exist in the content object.

Discussion

Returns the NSDictionary object associated with the given key.

Declared In

NMContent.h

getDouble:

Returns the double value associated with the given key.

- (double)getDouble:(NSString *)key

Parameters

key

Alphanumeric string that corresponds the requested object.

Return Value

The double value for the specified key. Returns NSNotFound if key-value pairs does not exist in the content object.

Discussion

Returns the double value associated with the given key.

Declared In

NMContent.h

getInt:

Returns the integer value associated with the given key.

- (int)getInt:(NSString *)key

Parameters

key

Alphanumeric string that corresponds the requested object.

Return Value

The integer value for the specified key. Returns NSNotFound if key-value pairs does not exist in the content object.

Discussion

Returns the integer value associated with the given key.

Declared In

NMContent.h

getLocation:

Returns the NMGeolocation object associated with the given key.

- (NMGeolocation *)getLocation:(NSString *)key

Parameters

key

Alphanumeric string that corresponds the requested object.

Return Value

The NMGeolocation object for the specified key. Returns nil if key-value pairs does not exist in the content object.

Discussion

Returns the NMGeolocation object associated with the given key.

Declared In

NMContent.h

getLong:

Returns the long value associated with the given key.

- (long)getLong:(NSString *)key

Parameters

key

Alphanumeric string that corresponds the requested object.

Return Value

The long value for the specified key. Returns NSNotFound if key-value pairs does not exist in the content object.

Discussion

Returns the long value associated with the given key.

Declared In

NMContent.h

getString:

Returns the NSString object associated with the given key.

- (NSString *)getString:(NSString *)key

Parameters

key

Alphanumeric string that corresponds the requested object.

Return Value

The NSString object for the specified key. Returns nil if key-value pairs does not exist in the content object.

Discussion

Returns the NSString object associated with the given key.

Declared In

NMContent.h

getUser:

Returns the NMUser object associated with the given key.

- (NMUser *)getUser:(NSString *)key

Parameters

key

Alphanumeric string that corresponds the requested object.

Return Value

The NMUser object for the specified key. Returns nil if key-value pairs does not exist in the content object.

Discussion

Returns the NMUser object associated with the given key.

Declared In

NMContent.h

incrementByValue:forKey:

Increases/decreases a field of a content by the given value on create or update operation. If the value is a positive number, the field is increased, otherwise it is decreased.

- (void)incrementByValue:(NSNumber *)value forKey:(NSString *)key

Parameters

value

The increment or decrement value for the field.

key

Alphanumeric string that represents the field to perform operation.

Discussion

Increases/decreases a field of a content by the given value on create or update operation. If the value is a positive number, the field is increased, otherwise it is decreased.

If the field does not exist for a content object while creating or updating, new field is created for it with the given key and value.

Declared In

NMContent.h

init

- (id)init

Discussion

content

Declared In

NMContent.m

initWithIdentifier:

Initializes the newly allocated NMContent object with the specified identifier value.

- (id)initWithIdentifier:(NSString *)identifier

Parameters

identifier

Identifier of the NMContent object.

Return Value

An initialized NMContent object.

Discussion

Initializes the newly allocated NMContent object with the specified identifier value.

Declared In

NMContent.h

initWithObjectName:

Initializes the newly allocated NMContent object with the specified identifier value.

- (NMContent *)initWithObjectName:(NSString *)objectName

Parameters

identifier

Identifier of the NMContent object.

Return Value

An initialized NMContent object.

Discussion

Initializes the newly allocated NMContent object with the specified identifier value.

Declared In

NMContent.h

locationForKey:

Returns the NMGeolocation object associated with the given key.

- (NMGeolocation *)locationForKey:(NSString *)key

Parameters

key

Alphanumeric string that corresponds the requested object.

Return Value

The NMGeolocation object for the specified key. Returns nil if key-value pairs does not exist in the content object.

Discussion

Returns the NMGeolocation object associated with the given key.

Declared In

NMContent.h

objectForKey:

Returns the object associated with the given key.

- (id)objectForKey:(NSString *)key

Parameters

key

Alphanumeric string that corresponds the requested object.

Return Value

The object for the specified key. Returns nil if key-value pairs does not exist in the content object.

Discussion

Returns the object associated with the given key.

Declared In

NMContent.h

setBool:forKey:

Adds JSON-compatible key-value pairs into the object. If the object contains the given key, the old value is replaced with the new ones. Value is a BOOL type.

- (void)setBool:(BOOL)value forKey:(NSString *)key

Parameters

value

BOOL value associated with the specified key.

key

Alphanumeric string that represents the key value.

Discussion

Adds JSON-compatible key-value pairs into the object. If the object contains the given key, the old value is replaced with the new ones. Value is a BOOL type.

Warning: Raises an exception if value is not an object that NSDictionary accepts or the value is not a JSON-compatible object.s

Declared In

NMContent.h

setObject:forKey:

Adds JSON-compatible key-value pairs into the object. If the object contains the given key, the old value is replaced with the new ones.

- (void)setObject:(id)object forKey:(NSString *)key

Parameters

key

Alphanumeric string that represents the key value.

value

Object value associated with the specified key. This value can be an instance of the below classes:

NSString, NSNumber, NSDate, NSData, NSDictionary (members must be one of the mentioned class instances), NSArray (members must be one of the above instance), NMGeolocation, NMUser.

Discussion

Adds JSON-compatible key-value pairs into the object. If the object contains the given key, the old value is replaced with the new ones.

Warning: Raises an exception if value is not an object that NSDictionary accepts or the value is not a JSON-compatible object.

Declared In

NMContent.h

setOwner:

Sets the owner of this content. This provides that the receiver NMContent object is private for just the owner.

- (void)setOwner:(NMUser *)user

Parameters

user

Owner of the content.

Discussion

Sets the owner of this content. This provides that the receiver NMContent object is private for just the owner.

You cannot give any user object as the owner of the content. The user should be login to the application for the current state.

Declared In

NMContent.h

update:

Updates a content that contains JSON-compatible key-value pairs over cloud. After adding needful key-value pairs, call this method over receiver.

- (BOOL)update:(NSError **)error

Parameters

error

On input, a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify nil for this parameter if you do not want the error information.

Return Value

YES if the content is updated successfully. Returns NO if an error occurs.

Discussion

Updates a content that contains JSON-compatible key-value pairs over cloud. After adding needful key-value pairs, call this method over receiver.

Warning: In order to update a content, firstly the relevant content should be fetched using get or search methods.

Declared In

NMContent.h

updateInBackgroundWithCompletionHandler:

Updates a content that contains JSON-compatible key-value pairs over cloud on background thread and executes the given handler block at the completion of running method. After adding needful key-value pairs, call this method over receiver.

- (void)updateInBackgroundWithCompletionHandler:(NMContentResponseHandler)handler

Parameters

handler

The block to execute when update of the content is completed.

Discussion

Updates a content that contains JSON-compatible key-value pairs over cloud on background thread and executes the given handler block at the completion of running method. After adding needful key-value pairs, call this method over receiver.

Warning: In order to update a content, firstly the relevant content should be fetched using get or search methods.

As background methods does not block your main thread, it is recommended to use updateInBackgroundWithCompletionHandler: over updateWithError: or update:.

Declared In

NMContent.h

updateWithError:

Updates a content that contains JSON-compatible key-value pairs over cloud. After adding needful key-value pairs, call this method over receiver.

- (BOOL)updateWithError:(NSError **)error

Parameters

error

On input, a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify nil for this parameter if you do not want the error information.

Return Value

YES if the content is updated successfully. Returns NO if an error occurs.

Discussion

Updates a content that contains JSON-compatible key-value pairs over cloud. After adding needful key-value pairs, call this method over receiver.

Warning: In order to update a content, firstly the relevant content should be fetched using get or search methods.

Declared In

NMContent.h

userForKey:

Returns the NMUser object associated with the given key.

- (NMUser *)userForKey:(NSString *)key

Parameters

key

Alphanumeric string that corresponds the requested object.

Return Value

The NMUser object for the specified key. Returns nil if key-value pairs does not exist in the content object.

Discussion

Returns the NMUser object associated with the given key.

Declared In

NMContent.h