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
-
rawMessageproperty -
dataproperty -
apnsFieldsproperty -
gcmFieldsproperty -
mqttFieldsproperty -
sendToDevelopmentproperty -
sendToProductionproperty -
pushMessageTypeproperty -
sendAppIDproperty -
sendSenderproperty -
sendWhenproperty -
sendOriginproperty -
sendObjectScopeproperty -
sendTopicIDproperty -
+ 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 *apnsFieldsDiscussion
APNS-specific fields.
Declared In
KiiPushMessage.hdata
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 *dataDiscussion
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.hgcmFields
GCM-specific fields.
@property (nonatomic, nullable) KiiGCMFields *gcmFieldsDiscussion
GCM-specific fields.
Declared In
KiiPushMessage.hmqttFields
MQTT-specific fields.
@property (nonatomic, nullable) KiiMQTTFields *mqttFieldsDiscussion
MQTT-specific fields.
Declared In
KiiPushMessage.hpushMessageType
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 *pushMessageTypeDiscussion
String. Not required. Value that will optionally indicate what is the type of the message. Event-generated push messages contain it.
Declared In
KiiPushMessage.hrawMessage
Dictionary representation of APNs received message. (Deprecated: Use KiiReceivedMessage)
@property (nonatomic, readonly, nullable) NSDictionary *rawMessageDiscussion
Dictionary representation of APNs received message.
Declared In
KiiPushMessage.hsendAppID
Boolean. Not required. If true, the appID field will also be sent. Default is false.
@property (nonatomic, nullable) NSNumber *sendAppIDDiscussion
Boolean. Not required. If true, the appID field will also be sent. Default is false.
Declared In
KiiPushMessage.hsendObjectScope
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 *sendObjectScopeDiscussion
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.hsendOrigin
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 *sendOriginDiscussion
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.hsendSender
Boolean. Not required. If true, send the “sender” field (userID of the user that triggered the notification). Default is true.
@property (nonatomic, nullable) NSNumber *sendSenderDiscussion
Boolean. Not required. If true, send the “sender” field (userID of the user that triggered the notification). Default is true.
Declared In
KiiPushMessage.hsendToDevelopment
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 *sendToDevelopmentDiscussion
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.hsendToProduction
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 *sendToProductionDiscussion
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.hsendTopicID
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 *sendTopicIDDiscussion
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.hsendWhen
Boolean. Not required. If true, send the “when” field (when the push message was sent). Default is false.
@property (nonatomic, nullable) NSNumber *sendWhenDiscussion
Boolean. Not required. If true, send the “when” field (when the push message was sent). Default is false.
Declared In
KiiPushMessage.hClass 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 *)gcmfieldsParameters
- 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.hcomposeMessageWithAPNSFields: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 *)mqttFieldsParameters
- 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.hcomposeMessageWithData:
Constructor method that composes a message for all platform (APNS, FCM, MQTT) and provide common payload data.
+ (instancetype)composeMessageWithData:(nullable NSDictionary *)commonDataParameters
- 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.hmessageFromAPNS:
Parse incoming APNs message. (Deprecated: Use KiiReceivedMessage)
+ (KiiPushMessage *)messageFromAPNS:(NSDictionary *)userInfoParameters
- 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.hInstance Methods
containsKiiBucket
- Checks whether the push message contains KiiBucket or not. (Deprecated: Use KiiReceivedMessage *)
- (BOOL)containsKiiBucketReturn Value
YES if the push message contains KiiBucket, otherwise NO.
Discussion
- Checks whether the push message contains KiiBucket or not.
Declared In
KiiPushMessage.hcontainsKiiObject
- Checks whether the push message contains KiiObject or not. (Deprecated: Use KiiReceivedMessage)
- (BOOL)containsKiiObjectReturn Value
YES if the push message contains KiiObject, otherwise NO.
Discussion
- Checks whether the push message contains KiiObject or not.
Declared In
KiiPushMessage.hcontainsKiiTopic
- Checks whether the push message contains KiiTopic or not. (Deprecated: Use KiiReceivedMessage)
- (BOOL)containsKiiTopicReturn Value
YES if the push message contains KiiTopic, otherwise NO.
Discussion
- Checks whether the push message contains KiiTopic or not.
Declared In
KiiPushMessage.heventSourceBucket
Obtain KiiBucket based on the information parsed from push message. (Deprecated: Use KiiReceivedMessage)
- (nullable KiiBucket *)eventSourceBucketReturn 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.heventSourceGroup
Obtain KiiGroup based on the information parsed from push message scope. (Deprecated: Use KiiReceivedMessage)
- (nullable KiiGroup *)eventSourceGroupReturn 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.heventSourceObject
Obtain KiiObject based on the information parsed from push message. (Deprecated: Use KiiReceivedMessage)
- (nullable KiiObject *)eventSourceObjectReturn 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.heventSourceThing
Obtain KiiThing based on the information parsed from push message. (Deprecated: Use KiiReceivedMessage)
- (nullable KiiThing *)eventSourceThingReturn 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.heventSourceTopic
Obtain KiiTopic based on the information parsed from push message. (Deprecated: Use KiiReceivedMessage)
- (nullable KiiTopic *)eventSourceTopicReturn 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.heventSourceUser
Obtain KiiUser based on the information parsed from push message. (Deprecated: Use KiiReceivedMessage)
- (nullable KiiUser *)eventSourceUserReturn 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.hgetAlertBody
Get alert body’s text message. (Deprecated: Use KiiReceivedMessage)
- (nullable NSString *)getAlertBodyReturn Value
A NSString object of alert body text message.
Discussion
Get alert body’s text message.
Declared In
KiiPushMessage.hgetValueOfKiiMessageField:
Get specific value of received message meta data. (Deprecated: Use KiiReceivedMessage)
- (nullable NSString *)getValueOfKiiMessageField:(KiiMessageField)fieldParameters
- 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.hmessageScope
Obtain scope of the bucket/topic. (Deprecated: Use KiiReceivedMessage)
- (KiiMessageScope)messageScopeReturn Value
enumeration of message scope. If not provided, it will return KiiMessageScope_UNKNOWN;
Discussion
Obtain scope of the bucket/topic.
Declared In
KiiPushMessage.hsenderThing
Obtain KiiThing based on the information parsed from push message. (Deprecated: Use KiiReceivedMessage)
- (nullable KiiThing *)senderThingReturn 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.hsenderUser
Obtain KiiUser based on the information parsed from push message . (Deprecated: Use KiiReceivedMessage)
- (nullable KiiUser *)senderUserReturn 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.hsetAPNSEnabled:
Set flag of APNS delivery If omit calling this method, APNS delivery is enabled.
- (void)setAPNSEnabled:(BOOL)enabledParameters
- 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.hsetGCMEnabled:
Set flag of GCM delivery If omit calling this method, GCM delivery is enabled.
- (void)setGCMEnabled:(BOOL)enabledParameters
- 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.hsetMQTTEnabled:
Set flag of MQTT delivery If omit calling this method, MQTT delivery is enabled.
- (void)setMQTTEnabled:(BOOL)enabledParameters
- 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.hshowMessageAlertWithTitle:
Show simple alert to display alert body’s message. (Deprecated: Use KiiReceivedMessage)
- (void)showMessageAlertWithTitle:(nullable NSString *)titleParameters
- title
A alert title to display.
Discussion
Show simple alert to display alert body’s message.
Declared In
KiiPushMessage.h