RLMApp
@interface RLMApp : NSObject
The RLMApp
has the fundamental set of methods for communicating with a Realm
application backend.
This interface provides access to login and authentication.
-
The configuration for this Realm app.
Declaration
Objective-C
@property (readonly, nonatomic) RLMAppConfiguration *_Nonnull configuration;
-
The
RLMSyncManager
for this Realm app.Declaration
Objective-C
@property (readonly, nonatomic) RLMSyncManager *_Nonnull syncManager;
-
Get an application with a given appId and configuration.
Declaration
Objective-C
+ (nonnull instancetype)appWithId:(nonnull NSString *)appId;
Parameters
appId
The unique identifier of your Realm app.
-
Get an application with a given appId and configuration.
Declaration
Objective-C
+ (nonnull instancetype)appWithId:(nonnull NSString *)appId configuration:(nullable RLMAppConfiguration *)configuration;
Parameters
appId
The unique identifier of your Realm app.
configuration
A configuration object to configure this client.
-
Get a dictionary containing all users keyed on id.
Declaration
Objective-C
- (nonnull NSDictionary<NSString *, RLMSyncUser *> *)allUsers;
-
Get the current user logged into the Realm app.
Declaration
Objective-C
- (nullable RLMSyncUser *)currentUser;
-
Login to a user for the Realm app.
Declaration
Objective-C
- (void)loginWithCredential:(nonnull RLMAppCredentials *)credentials completion:(nonnull RLMUserCompletionBlock)completion;
Parameters
credentials
The credentials identifying the user.
completion
A callback invoked after completion.
-
Switches the active user to the specified user.
This sets which user is used by all RLMApp operations which require a user. This is a local operation which does not access the network. An exception will be throw if the user is not valid. The current user will remain logged in.
Declaration
Objective-C
- (nonnull RLMSyncUser *)switchToUser:(nonnull RLMSyncUser *)syncUser;
Parameters
syncUser
The user to switch to. @returns The user you intend to switch to
-
Removes a specified user
This logs out and destroys the session related to the user. The completion block will return an error if the user is not found or is already removed.
Declaration
Objective-C
- (void)removeUser:(nonnull RLMSyncUser *)syncUser completion:(nonnull RLMOptionalErrorBlock)completion;
Parameters
syncUser
The user you would like to remove
completion
A callback invoked on completion
-
Logs out the current user
The users state will be set to
Removed
is they are an anonymous user orLoggedOut
if they are authenticated by a username / password or third party auth clients If the logout request fails, this method will still clear local authentication state.Declaration
Objective-C
- (void)logOutWithCompletion:(nonnull RLMOptionalErrorBlock)completion;
Parameters
completion
A callback invoked on completion
-
Logs out a specific user
The users state will be set to
Removed
is they are an anonymous user orLoggedOut
if they are authenticated by a username / password or third party auth clients If the logout request fails, this method will still clear local authentication state.Declaration
Objective-C
- (void)logOut:(nonnull RLMSyncUser *)syncUser completion:(nonnull RLMOptionalErrorBlock)completion;
Parameters
syncUser
The user to log out
completion
A callback invoked on completion
-
Links the currently authenticated user with a new identity, where the identity is defined by the credential specified as a parameter. This will only be successful if this
RLMSyncUser
is the currently authenticated with the client from which it was created. On success a new user will be returned with the new linked credentials.Declaration
Objective-C
- (void)linkUser:(nonnull RLMSyncUser *)syncUser credentials:(nonnull RLMAppCredentials *)credentials completion:(nonnull RLMUserCompletionBlock)completion;
Parameters
syncUser
The user which will have the credentials linked to, the user must be logged in
credentials
The
RLMAppCredentials
used to link the user to a new identity.completion
The completion handler to call when the linking is complete. If the operation is successful, the result will contain a new
RLMSyncUser
object representing the currently logged in user. -
A client for the username/password authentication provider which can be used to obtain a credential for logging in.
Used to perform requests specifically related to the username/password provider.
Declaration
Objective-C
- (nonnull RLMUsernamePasswordProviderClient *)usernamePasswordProviderClient;
-
A client for the user API key authentication provider which can be used to create and modify user API keys.
This client should only be used by an authenticated user.
Declaration
Objective-C
- (nonnull RLMUserAPIKeyProviderClient *)userAPIKeyProviderClient;
-
A client for interacting with a remote MongoDB instance
Declaration
Objective-C
- (nonnull RLMMongoClient *)mongoClientWithServiceName: (nonnull NSString *)serviceName;
Parameters
serviceName
The name of the MongoDB service
-
Calls the MongoDB Realm function with the provided name and arguments.
Declaration
Objective-C
- (void)callFunctionNamed:(nonnull NSString *)name arguments:(nonnull NSArray<id<RLMBSON>> *)arguments completionBlock: (nonnull RLMCallFunctionCompletionBlock)completionBlock;
Parameters
name
The name of the MongoDB Realm function to be called.
arguments
The
BSONArray
of arguments to be provided to the function.completionBlock
The completion handler to call when the function call is complete. This handler is executed on a non-main global
DispatchQueue
. -
Unavailable
Use +appWithId or appWithId:configuration:.
RLMApp instances are cached internally by Realm and cannot be created directly.
Use
+[RLMRealm appWithId]
or+[RLMRealm appWithId:configuration:]
to obtain a reference to an RLMApp.Declaration
Objective-C
- (nonnull instancetype)init;
-
Unavailable
Use +appWithId or appWithId:configuration:.
RLMApp instances are cached internally by Realm and cannot be created directly.
Use
+[RLMRealm appWithId]
or+[RLMRealm appWithId:configuration:]
to obtain a reference to an RLMApp.Declaration
Objective-C
+ (nonnull instancetype)new;