PFInstallation Class Reference

Inherits from PFObject : NSObject
Conforms to PFSubclassing
Declared in PFInstallation.h

Overview

A Parse Framework Installation Object that is a local representation of an installation persisted to the Parse cloud. This class is a subclass of a PFObject, and retains the same functionality of a PFObject, but also extends it with installation-specific fields and related immutability and validity checks.

A valid PFInstallation can only be instantiated via [PFInstallation currentInstallation] because the required identifier fields are readonly. The timeZone and badge fields are also readonly properties which are automatically updated to match the device’s time zone and application badge when the PFInstallation is saved, thus these fields might not reflect the latest device state if the installation has not recently been saved.

PFInstallation objects which have a valid deviceToken and are saved to the Parse cloud can be used to target push notifications.

Accessing the Current Installation

+ currentInstallation

Gets the currently-running installation from disk and returns an instance of it.

+ (instancetype)currentInstallation

Return Value

Returns a PFInstallation that represents the currently-running installation.

Discussion

If this installation is not stored on disk, returns a PFInstallation with deviceType and installationId fields set to those of the current installation.

Declared In

PFInstallation.h

Installation Properties

  deviceType

The device type for the PFInstallation.

@property (nonatomic, copy, readonly) NSString *deviceType

Declared In

PFInstallation.h

  installationId

The installationId for the PFInstallation.

@property (nonatomic, copy, readonly) NSString *installationId

Declared In

PFInstallation.h

  deviceToken

The device token for the PFInstallation.

@property (nullable, nonatomic, copy) NSString *deviceToken

Declared In

PFInstallation.h

  badge

The badge for the PFInstallation.

@property (nonatomic, assign) NSInteger badge

Declared In

PFInstallation.h

  timeZone

The name of the time zone for the PFInstallation.

@property (nullable, nonatomic, copy, readonly) NSString *timeZone

Declared In

PFInstallation.h

  channels

The channels for the PFInstallation.

@property (nullable, nonatomic, copy) NSArray PF_GENERIC ( NSString **channels

Declared In

PFInstallation.h

– setDeviceTokenFromData:

Sets the device token string property from an NSData-encoded token.

- (void)setDeviceTokenFromData:(nullable NSData *)deviceTokenData

Parameters

deviceTokenData

A token that identifies the device.

Declared In

PFInstallation.h

Querying for Installations

+ query

Creates a PFQuery for PFInstallation objects.

+ (nullable PFQuery *)query

Discussion

Only the following types of queries are allowed for installations:

  • [query getObjectWithId:<value>]
  • [query whereKey:@"installationId" equalTo:<value>]
  • [query whereKey:@"installationId" matchesKey:<key in query> inQuery:<query>]

You can add additional query conditions, but one of the above must appear as a top-level AND clause in the query.

Declared In

PFInstallation.h