Mobile SDK iOS: EPZPushPreferenceItem
From ePrize Developers Wiki
Revision as of 21:19, 6 November 2014
Contents |
Overview
The EPZPushPreferenceItem class stores all necessary information specific to a push notification preference object. EPZPushPreferenceItem objects are data classes that are used in the SDK’s built-in EPZPushPreferenceViewController, where the preference items are listed with toggle switches which the user can turn on/off as desired. All properties of this class are read-only.
Note: Unless you are creating a custom view controller to handle user preferences (and thus not using the SDK’s built-in EPZPushPreferenceViewController), you will not need to create instances of this class, or otherwise reference instances of this class. By default, the SDK takes care of keeping track of getting/setting values, and syncing the values for saving when the savePushNotificationPreferences: method is called to save a user’s preferences.
Tasks
Getting Push Preference Information
preferenceID property
preferenceTitle property
preferenceValue property
preferences property
Creating a Push Preference Item
+ pushPreferenceItemWithData:
- initWithPreferenceData:
Setting and Updating Values
- updateValue:
- setItemPreferences:
Returning a Preference Object as Dictionary
- preferenceAsDictionary
Properties
preferenceID
The preference's unique ID. (read-only)
@property (nonatomic, readonly) NSString *preferenceID
Discussion
This property provides a reference to the preference’s unique ID, which is used to uniquely identify the preference.
Declared In
EPZPushPreferenceItem.h
preferenceTitle
The preference’s title. (read-only)
@property (nonatomic, readonly) NSString *preferenceTitle
Discussion
This property provides a reference to the preference’s title.
Declared In
EPZPushPreferenceItem.h
preferenceValue
The preference’s value. (read-only)
@property (nonatomic, readonly) BOOL *preferenceValue
Discussion
This property provides a reference to the preference’s value, which is a simple YES or NO value, and flags the HelloWorld Push Notification Service to either include (YES) or exclude (NO) this push preference type from being sent to the user’s device.
Declared In
EPZPushPreferenceItem.h
preferences
The preference’s nested preference items. (read-only)
@property (nonatomic, readonly) NSDictionary *preferences
Discussion
This property provides a reference to the preference’s nested preference items, if applicable. This value will be nil if no nested preference items are found.
Declared In
EPZPushPreferenceItem.h
Class Methods
pushPreferenceItemWithData:
Initializes and returns a newly allocated preference item with the data specified.
+ (EPZPushPreferenceItem *) pushPreferenceItemWithData:(NSDictionary *)data
Parameters
- data
- A dictionary of data used to create the preference item. This dictionary must have the following key/value pairs: "id","name", "value". If there are any nested preferences, they should be set via the setItemPreferences: method.
Discussion
This method returns an initialized instance of EPZPushPreferenceItem.
See Also
initWithPreferenceData:
Declared In
EPZPushPreferenceItem.h
Instance Methods
initWithPreferenceData:
Initializes and returns a newly allocated preference item with the data specified.
- (id) initWithPreferenceData:(NSDictionary *)data
Parameters
- data
- A dictionary of data used to create the preference item. This dictionary must have the following key/value pairs: "id","name", "value". If there are any nested preferences, they should be set via the setItemPreferences: method.
Discussion
This method returns an initialized instance of EPZPushPreferenceItem.
See Also
pushPreferenceItemWithData:
Declared In
EPZPushPreferenceItem.h
updateValue:
Update the preference’s value.
- (void) updateValue:(BOOL)newValue
Parameters
- newValue
- A boolean value of the new value to use for the preference item.
Discussion
This method updates the value of the EPZPushPreferenceItem with the new value specified.
Declared In
EPZPushPreferenceItem.h
setItemPreferences:
Method to set the item’s preferences.
- (void) setItemPreferences:(id)preferences
Parameters
- preferences
- An object (array or dictionary) of key/value pairs to use in setting the preference item’s nested preferences.
Discussion
This method should be called if it is necessary to set nested preferences on the preference item.
Declared In
EPZPushPreferenceItem.h
preferenceAsDictionary
Method to return the EPZPreferenceItem as an NSDictionary.
- (NSDictionary *) preferenceAsDictionary
Discussion
This method is a convenience method to return the preference item as a NSDictionary.
Declared In
EPZPushPreferenceItem.h