Parse

Objective-C

@interface Parse : NSObject

Swift

class Parse : NSObject

The Parse class contains static functions that handle global configuration for the Parse framework.

Connecting to Parse

  • Sets the applicationId and clientKey of your application.

    Declaration

    Objective-C

    + (void)setApplicationId:(nonnull NSString *)applicationId
                   clientKey:(nonnull NSString *)clientKey;

    Swift

    class func setApplicationId(_ applicationId: String, clientKey: String)

    Parameters

    applicationId

    The application id of your Parse application.

    clientKey

    The client key of your Parse application.

  • Sets the configuration to be used for the Parse SDK.

    Note

    Re-setting the configuration after having previously sent requests through the SDK results in undefined behavior.

    Declaration

    Objective-C

    + (void)initializeWithConfiguration:
        (nonnull ParseClientConfiguration *)configuration;

    Swift

    class func initialize(with configuration: ParseClientConfiguration)

    Parameters

    configuration

    The new configuration to set for the SDK.

  • Gets the current configuration in use by the Parse SDK.

    Declaration

    Objective-C

    @property (class, nonatomic, readonly, nullable) ParseClientConfiguration *currentConfiguration;

    Swift

    class var currentConfiguration: ParseClientConfiguration? { get }

    Return Value

    The current configuration in use by the SDK. Returns nil if the SDK has not been initialized yet.

  • The current application id that was used to configure Parse framework.

    Declaration

    Objective-C

    @property (class, nonatomic, readonly, nonnull) NSString *applicationId;

    Swift

    class var applicationId: String { get }
  • The current client key that was used to configure Parse framework.

    Declaration

    Objective-C

    @property (class, nonatomic, readonly, nullable) NSString *clientKey;

    Swift

    class var clientKey: String? { get }
  • The current server URL to connect to Parse Server.

    Declaration

    Objective-C

    @property (class, nonatomic, readonly, nullable) NSString *server;

    Swift

    class var server: String? { get }

Enabling Local Datastore

  • Enable pinning in your application. This must be called before your application can use pinning. The recommended way is to call this method before +setApplicationId:clientKey:.

    Declaration

    Objective-C

    + (void)enableLocalDatastore;

    Swift

    class func enableLocalDatastore()
  • Flag that indicates whether Local Datastore is enabled.

    Declaration

    Objective-C

    @property (class, nonatomic, readonly) BOOL isLocalDatastoreEnabled;

    Swift

    class var isLocalDatastoreEnabled: Bool { get }

    Return Value

    YES if Local Datastore is enabled, otherwise NO.

Enabling Extensions Data Sharing

  • Enables data sharing with an application group identifier.

    After enabling - Local Datastore, PFUser.+currentUser, PFInstallation.+currentInstallation and all eventually commands are going to be available to every application/extension in a group that have the same Parse applicationId.

    Warning

    This method is required to be called before +setApplicationId:clientKey:.

    Declaration

    Objective-C

    + (void)enableDataSharingWithApplicationGroupIdentifier:
        (nonnull NSString *)groupIdentifier;

    Swift

    class func enableDataSharing(withApplicationGroupIdentifier groupIdentifier: String)

    Parameters

    groupIdentifier

    Application Group Identifier to share data with.

  • Enables data sharing with an application group identifier.

    After enabling - Local Datastore, PFUser.+currentUser, PFInstallation.+currentInstallation and all eventually commands are going to be available to every application/extension in a group that have the same Parse applicationId.

    Warning

    This method is required to be called before +setApplicationId:clientKey:. This method can only be used by application extensions.

    Declaration

    Objective-C

    + (void)enableDataSharingWithApplicationGroupIdentifier:
                (nonnull NSString *)groupIdentifier
                                      containingApplication:
                                          (nonnull NSString *)bundleIdentifier;

    Swift

    class func enableDataSharing(withApplicationGroupIdentifier groupIdentifier: String, containingApplication bundleIdentifier: String)

    Parameters

    groupIdentifier

    Application Group Identifier to share data with.

    bundleIdentifier

    Bundle identifier of the containing application.

  • Application Group Identifier for Data Sharing.

    Declaration

    Objective-C

    + (nonnull NSString *)applicationGroupIdentifierForDataSharing;

    Swift

    class func applicationGroupIdentifierForDataSharing() -> String

    Return Value

    NSString value if data sharing is enabled, otherwise nil.

  • Containing application bundle identifier for Data Sharing.

    Declaration

    Objective-C

    + (nonnull NSString *)containingApplicationBundleIdentifierForDataSharing;

    Swift

    class func containingApplicationBundleIdentifierForDataSharing() -> String

    Return Value

    NSString value if data sharing is enabled, otherwise nil.

Logging

  • Gets or sets the level of logging to display.

    By default:

    • If running inside an app that was downloaded from iOS App Store - it is set to PFLogLevelNone
    • All other cases - it is set to PFLogLevelWarning

    See

    PFLogLevel

    Declaration

    Objective-C

    @property (class, nonatomic) PFLogLevel logLevel;

    Swift

    class var logLevel: PFLogLevel { get set }

    Return Value

    A PFLogLevel value.