ParseInstallation
public protocol ParseInstallation : ParseObject
Objects that conform to the ParseInstallation
protocol have a local representation of an
installation persisted to the Parse cloud. This protocol inherits from the
ParseObject
protocol, and retains the same functionality of a ParseObject
, but also extends
it with installation-specific fields and related immutability and validity
checks.
A valid ParseInstallation
can only be instantiated via
current because the required identifier fields
are readonly. The timeZone
is also a readonly property which
is automatically updated to match the device’s time zone
when the ParseInstallation
is saved, thus these fields might not reflect the
latest device state if the installation has not recently been saved.
ParseInstallation
s which have a valid deviceToken
and are saved to
the Parse Server can be used to target push notifications. Use setDeviceToken
to set the
deviceToken
properly.
Warning
If the use of badge is desired, it should be retrieved by using UIKit, AppKit, etc. and
stored in ParseInstallation.badge
before saving/updating the installation.
Warning
Linux developers should set appName
, appIdentifier
, and appVersion
manually as ParseSwift
doesn’t have access to Bundle.main.
-
The device type for the
ParseInstallation
.Declaration
Swift
var deviceType: String? { get set }
-
The installationId for the
ParseInstallation
.Declaration
Swift
var installationId: String? { get set }
-
The device token for the
ParseInstallation
.Declaration
Swift
var deviceToken: String? { get set }
-
The badge for the
ParseInstallation
.Declaration
Swift
var badge: Int? { get set }
-
The name of the time zone for the
ParseInstallation
.Declaration
Swift
var timeZone: String? { get set }
-
The channels for the
ParseInstallation
.Declaration
Swift
var channels: [String]? { get set }
-
The application name for the
ParseInstallation
.Declaration
Swift
var appName: String? { get set }
-
The application identifier for the
ParseInstallation
.Declaration
Swift
var appIdentifier: String? { get set }
-
The application version for the
ParseInstallation
.Declaration
Swift
var appVersion: String? { get set }
-
The sdk version for the
ParseInstallation
.Declaration
Swift
var parseVersion: String? { get set }
-
The locale identifier for the
ParseInstallation
.Declaration
Swift
var localeIdentifier: String? { get set }
-
fetch(includeKeys:
Extension method, asynchronousoptions: ) Fetches the
ParseInstallation
aynchronously with the current data from the server and sets an error if one occurs.Throws
An error of typeParseError
.Important
If an object fetched has the same objectId as current, it will automatically update the current.Note
The default cache policy for this method is.reloadIgnoringLocalCacheData
. If a developer desires a different policy, it should be inserted inoptions
.Declaration
Swift
func fetch(includeKeys: [String]? = nil, options: API.Options = []) async throws -> Self
Parameters
includeKeys
The name(s) of the key(s) to include that are
ParseObject
s. Use["*"]
to include all keys. This is similar toinclude
andincludeAll
forQuery
.options
A set of header options sent to the server. Defaults to an empty set.
Return Value
Returns saved
ParseInstallation
. -
save(ignoringCustomObjectIdConfig:
Extension method, asynchronousoptions: ) Saves the
ParseInstallation
asynchronously.Throws
An error of typeParseError
.Important
If an object saved has the same objectId as current, it will automatically update the current.Warning
If you are usingParseConfiguration.isAllowingCustomObjectIds = true
and plan to generate all of yourobjectId
‘s on the client-side then you should leaveignoringCustomObjectIdConfig = false
. SettingParseConfiguration.isAllowingCustomObjectIds = true
andignoringCustomObjectIdConfig = true
means the client will generateobjectId
’s and the server will generate anobjectId
only when the client does not provide one. This can increase the probability of colliidingobjectId
’s as the client and serverobjectId
’s may be generated using different algorithms. This can also lead to overwriting ofParseObject
’s by accident as the client-side checks are disabled. Developers are responsible for handling such cases.Note
The default cache policy for this method is.reloadIgnoringLocalCacheData
. If a developer desires a different policy, it should be inserted inoptions
.Declaration
Swift
func save(ignoringCustomObjectIdConfig: Bool = false, options: API.Options = []) async throws -> Self
Parameters
ignoringCustomObjectIdConfig
Ignore checking for
objectId
whenParseConfiguration.isAllowingCustomObjectIds = true
to allow for mixedobjectId
environments. Defaults to false.options
A set of header options sent to the server. Defaults to an empty set.
Return Value
Returns saved
ParseInstallation
. -
create(options:
Extension method, asynchronous) Creates the
ParseInstallation
asynchronously.Throws
An error of typeParseError
.Declaration
Swift
func create(options: API.Options = []) async throws -> Self
Parameters
options
A set of header options sent to the server. Defaults to an empty set.
Return Value
Returns saved
ParseInstallation
. -
replace(options:
Extension method, asynchronous) Replaces the
ParseInstallation
asynchronously.Throws
An error of typeParseError
.Important
If an object replaced has the same objectId as current, it will automatically replace the current.Declaration
Swift
func replace(options: API.Options = []) async throws -> Self
Parameters
options
A set of header options sent to the server. Defaults to an empty set.
Return Value
Returns saved
ParseInstallation
. -
delete(options:
Extension method, asynchronous) Deletes the
ParseInstallation
asynchronously.Throws
An error of typeParseError
.Important
If an object deleted has the same objectId as current, it will automatically update the current.Declaration
Swift
func delete(options: API.Options = []) async throws
Parameters
options
A set of header options sent to the server. Defaults to an empty set.
Return Value
Returns saved
ParseInstallation
.
-
fetchPublisher(includeKeys:
Extension methodoptions: ) Fetches the
ParseInstallation
aynchronously with the current data from the server and sets an error if one occurs. Publishes when complete.Important
If an object fetched has the same objectId as current, it will automatically update the current.Note
The default cache policy for this method is.reloadIgnoringLocalCacheData
. If a developer desires a different policy, it should be inserted inoptions
.Declaration
Swift
func fetchPublisher(includeKeys: [String]? = nil, options: API.Options = []) -> Future<Self, ParseError>
Parameters
includeKeys
The name(s) of the key(s) to include that are
ParseObject
s. Use["*"]
to include all keys. This is similar toinclude
andincludeAll
forQuery
.options
A set of header options sent to the server. Defaults to an empty set.
Return Value
A publisher that eventually produces a single value and then finishes or fails.
-
savePublisher(ignoringCustomObjectIdConfig:
Extension methodoptions: ) Saves the
ParseInstallation
asynchronously and publishes when complete.Important
If an object saved has the same objectId as current, it will automatically update the current.Warning
If you are usingParseConfiguration.isAllowingCustomObjectIds = true
and plan to generate all of yourobjectId
‘s on the client-side then you should leaveignoringCustomObjectIdConfig = false
. SettingParseConfiguration.isAllowingCustomObjectIds = true
andignoringCustomObjectIdConfig = true
means the client will generateobjectId
’s and the server will generate anobjectId
only when the client does not provide one. This can increase the probability of colliidingobjectId
’s as the client and serverobjectId
’s may be generated using different algorithms. This can also lead to overwriting ofParseObject
’s by accident as the client-side checks are disabled. Developers are responsible for handling such cases.Note
The default cache policy for this method is.reloadIgnoringLocalCacheData
. If a developer desires a different policy, it should be inserted inoptions
.Declaration
Swift
func savePublisher(ignoringCustomObjectIdConfig: Bool = false, options: API.Options = []) -> Future<Self, ParseError>
Parameters
ignoringCustomObjectIdConfig
Ignore checking for
objectId
whenParseConfiguration.isAllowingCustomObjectIds = true
to allow for mixedobjectId
environments. Defaults to false.options
A set of header options sent to the server. Defaults to an empty set.
Return Value
A publisher that eventually produces a single value and then finishes or fails.
-
createPublisher(options:
Extension method) Creates the
ParseInstallation
asynchronously and publishes when complete.Declaration
Swift
func createPublisher(options: API.Options = []) -> Future<Self, ParseError>
Parameters
options
A set of header options sent to the server. Defaults to an empty set.
Return Value
A publisher that eventually produces a single value and then finishes or fails.
-
replacePublisher(options:
Extension method) Replaces the
ParseInstallation
asynchronously and publishes when complete.Important
If an object replaced has the same objectId as current, it will automatically replace the current.Declaration
Swift
func replacePublisher(options: API.Options = []) -> Future<Self, ParseError>
Parameters
options
A set of header options sent to the server. Defaults to an empty set.
Return Value
A publisher that eventually produces a single value and then finishes or fails.
-
deletePublisher(options:
Extension method) Deletes the
ParseInstallation
asynchronously and publishes when complete.Important
If an object deleted has the same objectId as current, it will automatically update the current.Declaration
Swift
func deletePublisher(options: API.Options = []) -> Future<Void, ParseError>
Parameters
options
A set of header options sent to the server. Defaults to an empty set.
Return Value
A publisher that eventually produces a single value and then finishes or fails.
-
className
Extension methodDeclaration
Swift
static var className: String { get }
-
mergeParse(with:
Extension method) Declaration
Swift
func mergeParse(with object: Self) throws -> Self
-
merge(with:
Extension method) Declaration
Swift
func merge(with object: Self) throws -> Self
-
setDeviceToken(_:
Extension method) Sets the device token string property from an
Data
-encoded token.Declaration
Swift
public mutating func setDeviceToken(_ data: Data)
Parameters
data
A token that identifies the device.
-
current
Extension methodGets/Sets properties of the current installation in the Keychain.
Declaration
Swift
internal(set) static var current: Self? { get set }
Return Value
Returns a
ParseInstallation
that is the current device. If there is none, returnsnil
.
-
fetch(includeKeys:
Extension methodoptions: ) Fetches the
ParseInstallation
synchronously with the current data from the server and sets an error if one occurs.Throws
An error ofParseError
type.Important
If an object fetched has the same objectId as current, it will automatically update the current.Note
The default cache policy for this method is.reloadIgnoringLocalCacheData
. If a developer desires a different policy, it should be inserted inoptions
.Declaration
Swift
public func fetch(includeKeys: [String]? = nil, options: API.Options = []) throws -> Self
Parameters
includeKeys
The name(s) of the key(s) to include that are
ParseObject
s. Use["*"]
to include all keys. This is similar toinclude
andincludeAll
forQuery
.options
A set of header options sent to the server. Defaults to an empty set.
-
fetch(includeKeys:
Extension methodoptions: callbackQueue: completion: ) Fetches the
ParseInstallation
asynchronously and executes the given callback block.Important
If an object fetched has the same objectId as current, it will automatically update the current.Note
The default cache policy for this method is.reloadIgnoringLocalCacheData
. If a developer desires a different policy, it should be inserted inoptions
.Declaration
Swift
public func fetch( includeKeys: [String]? = nil, options: API.Options = [], callbackQueue: DispatchQueue = .main, completion: @escaping (Result<Self, ParseError>) -> Void )
Parameters
includeKeys
The name(s) of the key(s) to include that are
ParseObject
s. Use["*"]
to include all keys. This is similar toinclude
andincludeAll
forQuery
.options
A set of header options sent to the server. Defaults to an empty set.
callbackQueue
The queue to return to after completion. Default value of .main.
completion
The block to execute when completed. It should have the following argument signature:
(Result<Self, ParseError>)
.
-
save(options:
Extension method) Saves the
ParseInstallation
synchronously and throws an error if there’s an issue.Throws
An error of typeParseError
.Important
If an object saved has the same objectId as current, it will automatically update the current.Declaration
Swift
public func save(options: API.Options = []) throws -> Self
Parameters
options
A set of header options sent to the server. Defaults to an empty set.
Return Value
Returns saved
ParseInstallation
. -
save(ignoringCustomObjectIdConfig:
Extension methodoptions: ) Saves the
ParseInstallation
synchronously and throws an error if there’s an issue.Throws
An error of typeParseError
.Important
If an object saved has the same objectId as current, it will automatically update the current.Warning
If you are usingParseConfiguration.isAllowingCustomObjectIds = true
and plan to generate all of yourobjectId
‘s on the client-side then you should leaveignoringCustomObjectIdConfig = false
. SettingParseConfiguration.isAllowingCustomObjectIds = true
andignoringCustomObjectIdConfig = true
means the client will generateobjectId
’s and the server will generate anobjectId
only when the client does not provide one. This can increase the probability of collidingobjectId
’s as the client and serverobjectId
’s may be generated using different algorithms. This can also lead to overwriting ofParseObject
’s by accident as the client-side checks are disabled. Developers are responsible for handling such cases.Note
The default cache policy for this method is.reloadIgnoringLocalCacheData
. If a developer desires a different policy, it should be inserted inoptions
.Declaration
Swift
public func save(ignoringCustomObjectIdConfig: Bool, options: API.Options = []) throws -> Self
Parameters
ignoringCustomObjectIdConfig
Ignore checking for
objectId
whenParseConfiguration.isAllowingCustomObjectIds = true
to allow for mixedobjectId
environments. Defaults to false.options
A set of header options sent to the server. Defaults to an empty set.
Return Value
Returns saved
ParseInstallation
. -
save(ignoringCustomObjectIdConfig:
Extension methodoptions: callbackQueue: completion: ) Saves the
ParseInstallation
asynchronously and executes the given callback block.Important
If an object saved has the same objectId as current, it will automatically update the current.Warning
If you are usingParseConfiguration.isAllowingCustomObjectIds = true
and plan to generate all of yourobjectId
‘s on the client-side then you should leaveignoringCustomObjectIdConfig = false
. SettingParseConfiguration.isAllowingCustomObjectIds = true
andignoringCustomObjectIdConfig = true
means the client will generateobjectId
’s and the server will generate anobjectId
only when the client does not provide one. This can increase the probability of collidingobjectId
’s as the client and serverobjectId
’s may be generated using different algorithms. This can also lead to overwriting ofParseObject
’s by accident as the client-side checks are disabled. Developers are responsible for handling such cases.Note
The default cache policy for this method is.reloadIgnoringLocalCacheData
. If a developer desires a different policy, it should be inserted inoptions
.Declaration
Swift
public func save( ignoringCustomObjectIdConfig: Bool = false, options: API.Options = [], callbackQueue: DispatchQueue = .main, completion: @escaping (Result<Self, ParseError>) -> Void )
Parameters
ignoringCustomObjectIdConfig
Ignore checking for
objectId
whenParseConfiguration.isAllowingCustomObjectIds = true
to allow for mixedobjectId
environments. Defaults to false.options
A set of header options sent to the server. Defaults to an empty set.
callbackQueue
The queue to return to after completion. Default value of .main.
completion
The block to execute. It should have the following argument signature:
(Result<Self, ParseError>)
. -
create(options:
Extension methodcallbackQueue: completion: ) Creates the
ParseInstallation
asynchronously and executes the given callback block.Note
The default cache policy for this method is.reloadIgnoringLocalCacheData
. If a developer desires a different policy, it should be inserted inoptions
.Declaration
Swift
public func create( options: API.Options = [], callbackQueue: DispatchQueue = .main, completion: @escaping (Result<Self, ParseError>) -> Void )
Parameters
options
A set of header options sent to the server. Defaults to an empty set.
callbackQueue
The queue to return to after completion. Default value of .main.
completion
The block to execute. It should have the following argument signature:
(Result<Self, ParseError>)
. -
replace(options:
Extension methodcallbackQueue: completion: ) Replaces the
ParseInstallation
asynchronously and executes the given callback block.Important
If an object replaced has the same objectId as current, it will automatically replace the current.Note
The default cache policy for this method is.reloadIgnoringLocalCacheData
. If a developer desires a different policy, it should be inserted inoptions
.Declaration
Swift
public func replace( options: API.Options = [], callbackQueue: DispatchQueue = .main, completion: @escaping (Result<Self, ParseError>) -> Void )
Parameters
options
A set of header options sent to the server. Defaults to an empty set.
callbackQueue
The queue to return to after completion. Default value of .main.
completion
The block to execute. It should have the following argument signature:
(Result<Self, ParseError>)
.
-
delete(options:
Extension method) Deletes the
ParseInstallation
synchronously with the current data from the server and sets an error if one occurs.Throws
An error ofParseError
type.Important
If an object deleted has the same objectId as current, it will automatically update the current.Note
The default cache policy for this method is.reloadIgnoringLocalCacheData
. If a developer desires a different policy, it should be inserted inoptions
.Declaration
Swift
public func delete(options: API.Options = []) throws
Parameters
options
A set of header options sent to the server. Defaults to an empty set.
-
delete(options:
Extension methodcallbackQueue: completion: ) Deletes the
ParseInstallation
asynchronously and executes the given callback block.Important
If an object deleted has the same objectId as current, it will automatically update the current.Note
The default cache policy for this method is.reloadIgnoringLocalCacheData
. If a developer desires a different policy, it should be inserted inoptions
.Declaration
Swift
public func delete( options: API.Options = [], callbackQueue: DispatchQueue = .main, completion: @escaping (Result<Void, ParseError>) -> Void )
Parameters
options
A set of header options sent to the server. Defaults to an empty set.
callbackQueue
The queue to return to after completion. Default value of .main.
completion
The block to execute when completed. It should have the following argument signature:
(Result<Void, ParseError>)
.