LSMPNBuilder Class Reference

Inherits from NSObject
Declared in LSMPNBuilder.h

Overview

Utility class that provides methods to build or parse the JSON structure used to represent the format of a push notification.

It provides properties and methods to get and set the fields of a push notification, following the format specified by Apple’s Push Notification service (APNs). This format is compatible with [LSMPNSubscription notificationFormat].

– init

Creates an empty object to be used to create a push notification format from scratch.

Use setters methods to set the value of push notification fields.

- (nonnull instancetype)init

Declared In

LSMPNBuilder.h

– initWithNotificationFormat:

Creates an object based on the specified push notification format.

Use properties and setter methods to get and set the value of push notification fields.

- (nonnull instancetype)initWithNotificationFormat:(nonnull NSString *)notificationFormat

Parameters

notificationFormat

A JSON structure representing a push notification format.

Exceptions

NSException

if the notification is not a valid JSON structure.

Declared In

LSMPNBuilder.h

– build

Produces the JSON structure for the push notification format specified by this object.

- (nonnull NSString *)build

Declared In

LSMPNBuilder.h

– alert:

Sets the aps.alert field.

- (nonnull LSMPNBuilder *)alert:(nullable NSString *)alert

Parameters

alert

A string to be used for the aps.alert field value, or nil to clear it.

Declared In

LSMPNBuilder.h

  alert

Value of the aps.alert field.

@property (nonatomic, readonly, nullable) NSString *alert

Declared In

LSMPNBuilder.h

– badgeWithInt:

Sets the aps.alert field with an int value.

- (nonnull LSMPNBuilder *)badgeWithInt:(int)badge

Parameters

badge

An int to be used for the aps.alert field value.

Declared In

LSMPNBuilder.h

  badgeAsInt

Value of the aps.badge field as an int value.

@property (nonatomic, readonly) int badgeAsInt

Declared In

LSMPNBuilder.h

– badgeWithString:

Sets the aps.badge field with a string value.

- (nonnull LSMPNBuilder *)badgeWithString:(nullable NSString *)badge

Parameters

badge

A string to be used for the aps.badge field value, or nil to clear it.

Declared In

LSMPNBuilder.h

  badgeAsString

Value of the aps.badge field as a string value.

@property (nonatomic, readonly, nullable) NSString *badgeAsString

Declared In

LSMPNBuilder.h

– body:

Sets the aps.alert.body field.

- (nonnull LSMPNBuilder *)body:(nullable NSString *)body

Parameters

body

A string to be used for the aps.alert.body field value, or nil to clear it.

Declared In

LSMPNBuilder.h

  body

Value of the aps.alert.body field.

@property (nonatomic, readonly, nullable) NSString *body

Declared In

LSMPNBuilder.h

– bodyLocArguments:

Sets the aps.alert.loc-args field.

- (nonnull LSMPNBuilder *)bodyLocArguments:(nullable NSArray<NSString*> *)bodyLocArguments

Parameters

bodyLocArguments

An array of strings to be used for the aps.alert.loc-args field value, or nil to clear it.

Declared In

LSMPNBuilder.h

  bodyLocArguments

Value of the aps.alert.loc-args field as an array of strings.

@property (nonatomic, readonly, nullable) NSArray<NSString*> *bodyLocArguments

Declared In

LSMPNBuilder.h

– bodyLocKey:

Sets the aps.alert.loc-key field.

- (nonnull LSMPNBuilder *)bodyLocKey:(nullable NSString *)bodyLocKey

Parameters

bodyLocKey

A string to be used for the aps.alert.loc-key field value, or nil to clear it.

Declared In

LSMPNBuilder.h

  bodyLocKey

Value of the aps.alert.loc-key field.

@property (nonatomic, readonly, nullable) NSString *bodyLocKey

Declared In

LSMPNBuilder.h

– category:

Sets the aps.category field.

- (nonnull LSMPNBuilder *)category:(nullable NSString *)category

Parameters

category

A string to be used for the aps.category field value, or nil to clear it.

Declared In

LSMPNBuilder.h

  category

Value of the aps.category field.

@property (nonatomic, readonly, nullable) NSString *category

Declared In

LSMPNBuilder.h

– contentAvailableWithInt:

Sets the aps.content-available field with an int value.

- (nonnull LSMPNBuilder *)contentAvailableWithInt:(int)contentAvailable

Parameters

contentAvailable

An int to be used for the aps.content-available field value.

Declared In

LSMPNBuilder.h

  contentAvailableAsInt

Value of the aps.content-available field as an int value.

@property (nonatomic, readonly) int contentAvailableAsInt

Declared In

LSMPNBuilder.h

– contentAvailableWithString:

Sets the aps.content-available field with a string value.

- (nonnull LSMPNBuilder *)contentAvailableWithString:(nullable NSString *)contentAvailable

Parameters

contentAvailable

A string to be used for the aps.content-available field value, or nil to clear it.

Declared In

LSMPNBuilder.h

  contentAvailableAsString

Value of the aps.content-available field as a string value.

@property (nonatomic, readonly, nullable) NSString *contentAvailableAsString

Declared In

LSMPNBuilder.h

– mutableContentWithInt:

Sets the aps.mutable-content field with an int value.

- (nonnull LSMPNBuilder *)mutableContentWithInt:(int)mutableContent

Parameters

mutableContent

An int to be used for the aps.mutable-content field value.

Declared In

LSMPNBuilder.h

  mutableContentAsInt

Value of the aps.mutable-content field as an int value.

@property (nonatomic, readonly) int mutableContentAsInt

Declared In

LSMPNBuilder.h

– mutableContentWithString:

Sets the aps.mutable-content field with a string value.

- (nonnull LSMPNBuilder *)mutableContentWithString:(nullable NSString *)mutableContent

Parameters

mutableContent

A string to be used for the aps.mutable-content field value, or nil to clear it.

Declared In

LSMPNBuilder.h

  mutableContentAsString

Value of the aps.mutable-content field as a string value.

@property (nonatomic, readonly, nullable) NSString *mutableContentAsString

Declared In

LSMPNBuilder.h

– customData:

Sets fields in the root of the notification format (excluding aps).

- (nonnull LSMPNBuilder *)customData:(nullable NSDictionary<NSString*,id> *)customData

Parameters

customData

A dictionary to be used for fields in the root of the notification format (excluding aps), or nil to clear them.

Declared In

LSMPNBuilder.h

  customData

Fields in the root of the notification format (excluding aps).

@property (nonatomic, readonly, nullable) NSDictionary<NSString*id> *customData

Declared In

LSMPNBuilder.h

– launchImage:

Sets the aps.alert.launch-image field.

- (nonnull LSMPNBuilder *)launchImage:(nullable NSString *)launchImage

Parameters

launchImage

A string to be used for the aps.alert.launch-image field value, or nil to clear it.

Declared In

LSMPNBuilder.h

  launchImage

Value of the aps.alert.launch-image field.

@property (nonatomic, readonly, nullable) NSString *launchImage

Declared In

LSMPNBuilder.h

– locActionKey:

Sets the aps.alert.action-loc-key field.

- (nonnull LSMPNBuilder *)locActionKey:(nullable NSString *)locActionKey

Parameters

locActionKey

A string to be used for the aps.alert.action-loc-key field value, or nil to clear it.

Declared In

LSMPNBuilder.h

  locActionKey

Value of the aps.alert.action-loc-key field.

@property (nonatomic, readonly, nullable) NSString *locActionKey

Declared In

LSMPNBuilder.h

– sound:

Sets the aps.sound field.

- (nonnull LSMPNBuilder *)sound:(nullable NSString *)sound

Parameters

sound

A string to be used for the aps.sound field value, or nil to clear it.

Declared In

LSMPNBuilder.h

  sound

Value of the aps.sound field.

@property (nonatomic, readonly, nullable) NSString *sound

Declared In

LSMPNBuilder.h

– threadId:

Sets the aps.thread-id field.

- (nonnull LSMPNBuilder *)threadId:(nullable NSString *)threadId

Parameters

threadId

A string to be used for the aps.thread-id field value, or nil to clear it.

Declared In

LSMPNBuilder.h

  threadId

Value of the aps.thread-id field.

@property (nonatomic, readonly, nullable) NSString *threadId

Declared In

LSMPNBuilder.h

– title:

Sets the aps.alert.title field.

- (nonnull LSMPNBuilder *)title:(nullable NSString *)title

Parameters

title

A string to be used for the aps.alert.title field value, or nil to clear it.

Declared In

LSMPNBuilder.h

  title

Value of the aps.alert.title field.

@property (nonatomic, readonly, nullable) NSString *title

Declared In

LSMPNBuilder.h

– subtitle:

Sets the aps.alert.subtitle field.

- (nonnull LSMPNBuilder *)subtitle:(nullable NSString *)subtitle

Parameters

subtitle

A string to be used for the aps.alert.subtitle field value, or nil to clear it.

Declared In

LSMPNBuilder.h

  subtitle

Value of the aps.alert.subtitle field.

@property (nonatomic, readonly, nullable) NSString *subtitle

Declared In

LSMPNBuilder.h

– titleLocArguments:

Sets the aps.alert.title-loc-args field.

- (nonnull LSMPNBuilder *)titleLocArguments:(nullable NSArray<NSString*> *)titleLocArguments

Parameters

titleLocArguments

An array of strings to be used for the aps.alert.title-loc-args field value, or nil to clear it.

Declared In

LSMPNBuilder.h

  titleLocArguments

Value of the aps.alert.title-loc-args field.

@property (nonatomic, readonly, nullable) NSArray<NSString*> *titleLocArguments

Declared In

LSMPNBuilder.h

– titleLocKey:

Sets the aps.alert.title-loc-key field.

- (nonnull LSMPNBuilder *)titleLocKey:(nullable NSString *)titleLocKey

Parameters

titleLocKey

A string to be used for the aps.alert.title-loc-key field value, or nil to clear it.

Declared In

LSMPNBuilder.h

  titleLocKey

Value of the aps.alert.title-loc-key field.

@property (nonatomic, readonly, nullable) NSString *titleLocKey

Declared In

LSMPNBuilder.h