KiiPushMessage Class Reference
Inherits from | NSObject |
Declared in | KiiPushMessage.h |
Overview
Class for encapsulating outgoing push notification message Three types of push message supported by KiiCloud.
GCM restriction for reserved keyword
Based on Google GCM specification, there are reserved payload keys that should not be used inside data/specific data. If GCM is enabled and the data contains one or more reserve keys, an error (code 712) will be thrown. Following are the list of GCM reserved keys:
- any key prefix with 'google'
- from
- registration_ids
- collapse_key
- data
- delay_while_idle
- time_to_live
- restricted_package_name
- dry_run
Tasks
-
rawMessage
property -
data
property -
apnsFields
property -
gcmFields
property -
mqttFields
property -
sendToDevelopment
property -
sendToProduction
property -
pushMessageType
property -
sendAppID
property -
sendSender
property -
sendWhen
property -
sendOrigin
property -
sendObjectScope
property -
sendTopicID
property -
+ messageFromAPNS:
-
+ composeMessageWithAPNSFields:andGCMFields:
-
+ composeMessageWithAPNSFields:andGCMFields:andMQTTFields:
-
– getValueOfKiiMessageField:
-
– getAlertBody
-
– showMessageAlertWithTitle:
-
– eventSourceBucket
-
– eventSourceObject
-
– eventSourceTopic
-
– eventSourceUser
-
– eventSourceThing
-
– eventSourceGroup
-
– senderUser
-
– senderThing
-
– containsKiiBucket
-
– containsKiiObject
-
– containsKiiTopic
-
– messageScope
-
+ composeMessageWithData:
-
– setAPNSEnabled:
-
– setGCMEnabled:
-
– setMQTTEnabled:
Properties
apnsFields
APNS-specific fields.
@property (nonatomic, nullable) KiiAPNSFields *apnsFields
Discussion
APNS-specific fields.
Declared In
KiiPushMessage.h
data
Dictionary representation of JSON Object with only one-level of nesting. Required if no system-specific “data” fields has been provided for all the systems enabled. Dictionary with the data that will be sent to all the push systems enabled in this request. If gcmFields is defined, the data would be validated for GCM reserved payload keys.
@property (nonatomic, nullable) NSDictionary *data
Discussion
Dictionary representation of JSON Object with only one-level of nesting. Required if no system-specific “data” fields has been provided for all the systems enabled. Dictionary with the data that will be sent to all the push systems enabled in this request. If gcmFields is defined, the data would be validated for GCM reserved payload keys.
Declared In
KiiPushMessage.h
gcmFields
GCM-specific fields.
@property (nonatomic, nullable) KiiGCMFields *gcmFields
Discussion
GCM-specific fields.
Declared In
KiiPushMessage.h
mqttFields
MQTT-specific fields.
@property (nonatomic, nullable) KiiMQTTFields *mqttFields
Discussion
MQTT-specific fields.
Declared In
KiiPushMessage.h
pushMessageType
String. Not required. Value that will optionally indicate what is the type of the message. Event-generated push messages contain it.
@property (nonatomic, nullable) NSString *pushMessageType
Discussion
String. Not required. Value that will optionally indicate what is the type of the message. Event-generated push messages contain it.
Declared In
KiiPushMessage.h
rawMessage
Dictionary representation of APNs received message. (Deprecated: Use KiiReceivedMessage)
@property (nonatomic, readonly, nullable) NSDictionary *rawMessage
Discussion
Dictionary representation of APNs received message.
Declared In
KiiPushMessage.h
sendAppID
Boolean. Not required. If true, the appID field will also be sent. Default is false.
@property (nonatomic, nullable) NSNumber *sendAppID
Discussion
Boolean. Not required. If true, the appID field will also be sent. Default is false.
Declared In
KiiPushMessage.h
sendObjectScope
Boolean. Not required. If true, send the “objectScope”-related fields that contain the topic that is the source of this notification. Default is true.
@property (nonatomic, nullable) NSNumber *sendObjectScope
Discussion
Boolean. Not required. If true, send the “objectScope”-related fields that contain the topic that is the source of this notification. Default is true.
Declared In
KiiPushMessage.h
sendOrigin
Boolean. Not required. If true, send the “origin” field (indicates if the message is the result of an event or sent explicitly by someone. Default is false.
@property (nonatomic, nullable) NSNumber *sendOrigin
Discussion
Boolean. Not required. If true, send the “origin” field (indicates if the message is the result of an event or sent explicitly by someone. Default is false.
Declared In
KiiPushMessage.h
sendSender
Boolean. Not required. If true, send the “sender” field (userID of the user that triggered the notification). Default is true.
@property (nonatomic, nullable) NSNumber *sendSender
Discussion
Boolean. Not required. If true, send the “sender” field (userID of the user that triggered the notification). Default is true.
Declared In
KiiPushMessage.h
sendToDevelopment
Boolean. Not required. If true this message will be sent to the devices that have the property “development” to “true” in their installations. Default is true.
@property (nonatomic, nullable) NSNumber *sendToDevelopment
Discussion
Boolean. Not required. If true this message will be sent to the devices that have the property “development” to “true” in their installations. Default is true.
Declared In
KiiPushMessage.h
sendToProduction
Boolean. Not required. If true this message will be sent to the devices that have the property “development” to “false” or nil in their installations. Default is true.
@property (nonatomic, nullable) NSNumber *sendToProduction
Discussion
Boolean. Not required. If true this message will be sent to the devices that have the property “development” to “false” or nil in their installations. Default is true.
Declared In
KiiPushMessage.h
sendTopicID
Boolean. Not required. If true, send the “topicID” field, which contains the topicID that is the source of this notification. Default is true.
@property (nonatomic, nullable) NSNumber *sendTopicID
Discussion
Boolean. Not required. If true, send the “topicID” field, which contains the topicID that is the source of this notification. Default is true.
Declared In
KiiPushMessage.h
sendWhen
Boolean. Not required. If true, send the “when” field (when the push message was sent). Default is false.
@property (nonatomic, nullable) NSNumber *sendWhen
Discussion
Boolean. Not required. If true, send the “when” field (when the push message was sent). Default is false.
Declared In
KiiPushMessage.h
Class Methods
composeMessageWithAPNSFields:andGCMFields:
Constructor method that composes a message for explicit push (Deprecated: Use [KiiPushMessage composeMessage] instead.)
+ (KiiPushMessage *)composeMessageWithAPNSFields:(nullable KiiAPNSFields *)apnsfields andGCMFields:(nullable KiiGCMFields *)gcmfields
Parameters
- apnsfields
The message data for APNS
- gcmfields
The message data for GCM
Return Value
A KiiPushMessage instance that is associated to the message data.
Discussion
Constructor method that composes a message for explicit push
Declared In
KiiPushMessage.h
composeMessageWithAPNSFields:andGCMFields:andMQTTFields:
Constructor method that composes a message for explicit push. (Deprecated: Use [KiiPushMessage composeMessage] instead.)
+ (instancetype)composeMessageWithAPNSFields:(nullable KiiAPNSFields *)apnsFields andGCMFields:(nullable KiiGCMFields *)gcmFields andMQTTFields:(nullable KiiMQTTFields *)mqttFields
Parameters
- apnsFields
The message data for APNS.
- gcmFields
The message data for GCM.
- mqttFields
The message data for MQTT.
Return Value
A KiiPushMessage instance that is associated to the message data.
Discussion
Constructor method that composes a message for explicit push.
Declared In
KiiPushMessage.h
composeMessageWithData:
Constructor method that composes a message for all platform (APNS, FCM, MQTT) and provide common payload data.
+ (instancetype)composeMessageWithData:(nullable NSDictionary *)commonData
Parameters
- commonData
Dictionary representation of JSON Object with only one-level of nesting. Is equal to setting data property.
Return Value
A KiiPushMessage instance that is associated to the message data.
Discussion
Constructor method that composes a message for all platform (APNS, FCM, MQTT) and provide common payload data.
Declared In
KiiPushMessage.h
messageFromAPNS:
Parse incoming APNs message. (Deprecated: Use KiiReceivedMessage)
+ (KiiPushMessage *)messageFromAPNS:(NSDictionary *)userInfo
Parameters
- userInfo
An userInfo instance that received from APNs as a push message.
Return Value
A KiiPushMessage instance that is associated to the userInfo.
Discussion
Parse incoming APNs message.
Declared In
KiiPushMessage.h
Instance Methods
containsKiiBucket
- Checks whether the push message contains KiiBucket or not. (Deprecated: Use KiiReceivedMessage *)
- (BOOL)containsKiiBucket
Return Value
YES if the push message contains KiiBucket, otherwise NO.
Discussion
- Checks whether the push message contains KiiBucket or not.
Declared In
KiiPushMessage.h
containsKiiObject
- Checks whether the push message contains KiiObject or not. (Deprecated: Use KiiReceivedMessage)
- (BOOL)containsKiiObject
Return Value
YES if the push message contains KiiObject, otherwise NO.
Discussion
- Checks whether the push message contains KiiObject or not.
Declared In
KiiPushMessage.h
containsKiiTopic
- Checks whether the push message contains KiiTopic or not. (Deprecated: Use KiiReceivedMessage)
- (BOOL)containsKiiTopic
Return Value
YES if the push message contains KiiTopic, otherwise NO.
Discussion
- Checks whether the push message contains KiiTopic or not.
Declared In
KiiPushMessage.h
eventSourceBucket
Obtain KiiBucket based on the information parsed from push message. (Deprecated: Use KiiReceivedMessage)
- (nullable KiiBucket *)eventSourceBucket
Return Value
KiiBucket instance when the event of KiiBucket or KiiObject inside KiiBucket happened. In other cases returns nil.
Discussion
Obtain KiiBucket based on the information parsed from push message.
The payloads can contain the subscribed bucket informations including the scope and the type (encrypted or not). This API provides convenience methods to obtain KiiBucket if the payload contains the subscribed bucket information.
Declared In
KiiPushMessage.h
eventSourceGroup
Obtain KiiGroup based on the information parsed from push message scope. (Deprecated: Use KiiReceivedMessage)
- (nullable KiiGroup *)eventSourceGroup
Return Value
KiiGroup instance when the subscribed bucket/topic is group scope. In other cases returns nil.
Discussion
Obtain KiiGroup based on the information parsed from push message scope.
The payloads can contain the subscribed bucket/topic informations including the scope. This API provides convenience methods to obtain KiiGroup if the payload contains group scoped bucket/topic information.
Declared In
KiiPushMessage.h
eventSourceObject
Obtain KiiObject based on the information parsed from push message. (Deprecated: Use KiiReceivedMessage)
- (nullable KiiObject *)eventSourceObject
Return Value
KiiObject instance when the event of KiiObject * inside KiiBucket happened. In other cases returns nil.
Discussion
Obtain KiiObject based on the information parsed from push message.
The payloads can contain the subscribed bucket’s object informations including the scope. This API provides convenience methods to obtain KiiObject if the payload contains the object information.
Declared In
KiiPushMessage.h
eventSourceThing
Obtain KiiThing based on the information parsed from push message. (Deprecated: Use KiiReceivedMessage)
- (nullable KiiThing *)eventSourceThing
Return Value
KiiThing instance when the subscribed bucket/topic is thing scope. In other cases returns nil.
Discussion
Obtain KiiThing based on the information parsed from push message.
The payloads can contain the subscribed bucket/topic informations including the scope. This API provides convenience methods to obtain KiiThing if the payload contains thing scoped bucket/topic information.
Declared In
KiiPushMessage.h
eventSourceTopic
Obtain KiiTopic based on the information parsed from push message. (Deprecated: Use KiiReceivedMessage)
- (nullable KiiTopic *)eventSourceTopic
Return Value
KiiTopic instance when the event of KiiTopic (Push to User). In other cases returns nil.
Discussion
Obtain KiiTopic based on the information parsed from push message.
The payloads can contain the subscribed topic informations including the scope. This API provides convenience methods to obtain KiiTopic if the payload contains the subscribed topic information.
Declared In
KiiPushMessage.h
eventSourceUser
Obtain KiiUser based on the information parsed from push message. (Deprecated: Use KiiReceivedMessage)
- (nullable KiiUser *)eventSourceUser
Return Value
KiiUser instance when the subscribed bucket/topic is user scope. In other cases returns nil.
Discussion
Obtain KiiUser based on the information parsed from push message.
The payloads can contain the subscribed bucket/topic informations including the scope. This API provides convenience methods to obtain KiiUser if the payload contains user scoped bucket/topic information.
Declared In
KiiPushMessage.h
getAlertBody
Get alert body’s text message. (Deprecated: Use KiiReceivedMessage)
- (nullable NSString *)getAlertBody
Return Value
A NSString object of alert body text message.
Discussion
Get alert body’s text message.
Declared In
KiiPushMessage.h
getValueOfKiiMessageField:
Get specific value of received message meta data. (Deprecated: Use KiiReceivedMessage)
- (nullable NSString *)getValueOfKiiMessageField:(KiiMessageField)field
Parameters
- field
Enumeration of KiiMessageField.
Return Value
A NSString object that is associated to the message fields.
Discussion
Get specific value of received message meta data.
Declared In
KiiPushMessage.h
messageScope
Obtain scope of the bucket/topic. (Deprecated: Use KiiReceivedMessage)
- (KiiMessageScope)messageScope
Return Value
enumeration of message scope. If not provided, it will return KiiMessageScope_UNKNOWN;
Discussion
Obtain scope of the bucket/topic.
Declared In
KiiPushMessage.h
senderThing
Obtain KiiThing based on the information parsed from push message. (Deprecated: Use KiiReceivedMessage)
- (nullable KiiThing *)senderThing
Return Value
KiiThing instance when the sender of the message is a KiiThing. In other cases returns nil.
Discussion
Obtain KiiThing based on the information parsed from push message.
Declared In
KiiPushMessage.h
senderUser
Obtain KiiUser based on the information parsed from push message . (Deprecated: Use KiiReceivedMessage)
- (nullable KiiUser *)senderUser
Return Value
KiiUser instance when the sender of the message is a KiiUser. In other cases returns nil.
Discussion
Obtain KiiUser based on the information parsed from push message .
Declared In
KiiPushMessage.h
setAPNSEnabled:
Set flag of APNS delivery If omit calling this method, APNS delivery is enabled.
- (void)setAPNSEnabled:(BOOL)enabled
Parameters
- enabled
If YES message would be delivered via APNS. If NO, the apnsFields will set to nil and this message would not delivered thru APNS.
Discussion
Set flag of APNS delivery If omit calling this method, APNS delivery is enabled.
Declared In
KiiPushMessage.h
setGCMEnabled:
Set flag of GCM delivery If omit calling this method, GCM delivery is enabled.
- (void)setGCMEnabled:(BOOL)enabled
Parameters
- enabled
If YES message would be delivered via GCM. If NO, the gcmFields will set to nil and this message would not delivered thru GCM.
Discussion
Set flag of GCM delivery If omit calling this method, GCM delivery is enabled.
Declared In
KiiPushMessage.h
setMQTTEnabled:
Set flag of MQTT delivery If omit calling this method, MQTT delivery is enabled.
- (void)setMQTTEnabled:(BOOL)enabled
Parameters
- enabled
If YES message would be delivered via MQTT. If NO, the mqttFields will set to nil and this message would not delivered thru MQTT.
Discussion
Set flag of MQTT delivery If omit calling this method, MQTT delivery is enabled.
Declared In
KiiPushMessage.h
showMessageAlertWithTitle:
Show simple alert to display alert body’s message. (Deprecated: Use KiiReceivedMessage)
- (void)showMessageAlertWithTitle:(nullable NSString *)title
Parameters
- title
A alert title to display.
Discussion
Show simple alert to display alert body’s message.
Declared In
KiiPushMessage.h