#import <AgoraChatClient.h>
The AgoraChatClient, which is the entry point of the Chat SDK. You can log in, log out, and access other functionalities such as group and chatroom with this class. [AgoraChatClient sharedClient].groupManager;
◆ addDelegate:delegateQueue:
- (void) addDelegate: |
|
(id< AgoraChatClientDelegate >_Nonnull) |
aDelegate |
delegateQueue: |
|
(dispatch_queue_t _Nullable) |
aQueue |
|
|
| |
Add the AgoraChatClientDelegate, so when the delegate event occurs, the delegate will call the methods automatically in <AgoraChatClientDelegate>.
- Parameters
-
aDelegate | The delegate that you want to add: ClientDelegate. |
aQueue | (optional) The queue of calling delegate methods. If you want to run the app on the main thread, set this parameter as nil. |
◆ addLogDelegate:delegateQueue:
- (void) addLogDelegate: |
|
(id< AgoraChatLogDelegate >_Nonnull) |
aDelegate |
delegateQueue: |
|
(addLog(delegate:queue:)) |
NS_SWIFT_NAME |
|
|
| |
Add the log callback delegate.
- Parameters
-
aDelegate | The delegate that you want to add: AgoraChatLogDelegate. |
aQueue | The queue of calling delegate methods. |
◆ addMultiDevicesDelegate:delegateQueue:
- (void) addMultiDevicesDelegate: |
|
(id< AgoraChatMultiDevicesDelegate >_Nonnull) |
aDelegate |
delegateQueue: |
|
(addMultiDevices(delegate:queue:)) |
NS_SWIFT_NAME |
|
|
| |
Add the multi-device delegate.
- Parameters
-
aDelegate | The delegate that you want to add: MultiDevicesDelegate. |
aQueue | The queue of calling delegate methods. |
◆ application:didReceiveRemoteNotification:
- (void) application: |
|
(id _Nonnull) |
application |
didReceiveRemoteNotification: |
|
(NSDictionary *_Nullable) |
userInfo |
|
|
| |
Occurs when your app is running in the foreground and the device receives an Apple Push Notification (APN).
- Parameters
-
application | The current application instance. |
userInfo | The push content. |
◆ applicationDidEnterBackground:
- (void) applicationDidEnterBackground: |
|
(id _Nonnull) |
aApplication |
|
Disconnects from the chat server when the app is switched to background.
- Parameters
-
aApplication | UIApplication |
◆ applicationWillEnterForeground:
- (void) applicationWillEnterForeground: |
|
(id _Nonnull) |
aApplication |
|
Reconnect to the server when your app returns to foreground mode.
- Parameters
-
aApplication | The current application instance. |
◆ bindDeviceToken:
- (AgoraChatError *_Nullable) bindDeviceToken: |
|
(NSData *_Nonnull) |
aDeviceToken |
|
Device token binding is required to enable Apple Push Notification Service.
This is a synchronous method and blocks the current thread.
- Parameters
-
aDeviceToken | Device token to bind. |
@Result Returns nil on success, and the description of the issue that cause the call to fail.
◆ bindPushKitToken:
- (AgoraChatError *_Nullable) bindPushKitToken: |
|
(NSData *_Nullable) |
aPushToken |
|
Use the pushkit token to bind the user and the device, which is required to enable Apple PushKit Service.
This is a synchronous method and blocks the current thread.
- Parameters
-
aPushToken | The pushkit token to bind. |
- Returns
- A description of the issue that caused this call to fail.
◆ changeAppkey:
- (AgoraChatError *_Nullable) changeAppkey: |
|
(NSString *_Nonnull) |
aAppkey |
|
Update the unique identifier used to access server.
You retrieve the new app key from server. As this key controls all access to server for your app, you can only update the key when the current user is logged out.
- Parameters
-
@Result A description of the issue that caused this call to fail.
◆ fetchTokenWithUsername:password:completion:
- (void) fetchTokenWithUsername: |
|
(NSString *_Nonnull) |
aUsername |
password: |
|
(NSString *_Nonnull) |
aPassword |
completion: |
|
(void(^)(NSString *_Nullable aToken, AgoraChatError *_Nullable aError)) |
aCompletionBlock |
|
|
| |
Fetches the token from the server.
This is an asynchronous method.
- Parameters
-
aUsername | The username. |
aPassword | The password. |
aCompletionBlock | The completion block, which contains the token and the error message if the method fails. |
◆ getLogFilesPath:
- (NSString *_Nullable) getLogFilesPath: |
|
(AgoraChatError **_Nullable) |
pError |
|
Compress the debug log into a gzip archive. Best practice is to delete this debug archive as soon as it is no longer used.
This is a synchronous method and blocks the current thread.
- Parameters
-
pError | A description of the issue that caused this call to fail. |
- Returns
- NSString The full filepath to the debug archive.
◆ getLogFilesPathWithCompletion:
- (void) getLogFilesPathWithCompletion: |
|
(void(^)(NSString *_Nullable aPath, AgoraChatError *_Nullable aError)) |
aCompletionBlock |
|
Compresses the log files in the format of .gz and returns the path of the compressed file. Recommends deleting the compressed file when it is no longer used.
This is an asynchronous method.
- Parameters
-
aCompletionBlock | The completion block, which contains the token and the error message if the method fails. |
◆ getLoggedInDevicesFromServerWithUsername:password:completion:
- (void) getLoggedInDevicesFromServerWithUsername: |
|
(NSString *_Nonnull) |
aUsername |
password: |
|
(NSString *_Nonnull) |
aPassword |
completion: |
|
(void(^)(NSArray< AgoraChatDeviceConfig * > *_Nullable aList, AgoraChatError *_Nullable aError)) |
aCompletionBlock |
|
|
| |
Get all the device information <AgoraChatDeviceConfig> that logged in to the server.
This is an asynchronous method.
- Parameters
-
aUsername | The username. |
aPassword | The password. |
aCompletionBlock | The completion block, which contains the list and the error message if the method fails. |
◆ getLoggedInDevicesFromServerWithUsername:password:error:
- (NSArray< AgoraChatDeviceConfig * > *_Nullable) getLoggedInDevicesFromServerWithUsername: |
|
(NSString *_Nonnull) |
aUsername |
password: |
|
(NSString *_Nonnull) |
aPassword |
error: |
|
(AgoraChatError **_Nullable) |
pError |
|
|
| |
Retrieve the array of devices the user is currently logged into.
This is a synchronous method and blocks the current thread.
- Parameters
-
aUsername | The username. |
aPassword | The password. |
pError | A description of the issue that caused this call to fail. |
- Returns
- The information of the logged in devices, an array of <AgoraChatDeviceConfig> objects.
◆ initializeSDKWithOptions:
Initialize the SDK.
- Parameters
-
aOptions | The SDK setting options: Options.. |
@Result AgoraChatError A description of the issue that caused this call to fail.
◆ kickAllDevicesWithUsername:password:
- (AgoraChatError *_Nullable) kickAllDevicesWithUsername: |
|
(NSString *_Nonnull) |
aUsername |
password: |
|
(NSString *_Nonnull) |
aPassword |
|
|
| |
Kicks a user from your app installed on all the devices.
This is a synchronous method and blocks the current thread.
- Parameters
-
aUsername | The username. |
aPassword | The password. |
- Returns
- Returns nil on success, and the description of the issue that cause the call to fail.
◆ kickAllDevicesWithUsername:password:completion:
- (void) kickAllDevicesWithUsername: |
|
(NSString *_Nonnull) |
aUsername |
password: |
|
(NSString *_Nonnull) |
aPassword |
completion: |
|
(void(^)(AgoraChatError *_Nullable aError)) |
aCompletionBlock |
|
|
| |
Kicks a single user from your app installed on all the devices.
This is an asynchronous method.
- Parameters
-
aUsername | The username. |
aPassword | The password. |
aCompletionBlock | The completion block, which contains the error message if the method fails. |
◆ kickDeviceWithUsername:password:resource:
- (AgoraChatError *_Nullable) kickDeviceWithUsername: |
|
(NSString *_Nonnull) |
aUsername |
password: |
|
(NSString *_Nonnull) |
aPassword |
resource: |
|
(NSString *_Nonnull) |
aResource |
|
|
| |
Kick a single user from your app installed on a specific device.
This is a synchronous method and blocks the current thread.
- Parameters
-
aUsername | The username. |
aPassword | The password. |
aResource | The device to log aUsername out from. Call getLoggedInDevicesFromServerWithUsername to retrieve the list of devices aUsername is currently logged into. |
- Returns
- Returns nil on success, and the description of the issue that cause the call to fail.
◆ kickDeviceWithUsername:password:resource:completion:
- (void) kickDeviceWithUsername: |
|
(NSString *_Nonnull) |
aUsername |
password: |
|
(NSString *_Nonnull) |
aPassword |
resource: |
|
(NSString *_Nonnull) |
aResource |
completion: |
|
(void(^)(AgoraChatError *_Nullable aError)) |
aCompletionBlock |
|
|
| |
Kick a single user from your app installed on a specific device.
The device information can be obtained from getLoggedInDevicesFromServerWithUsername
.
This is an asynchronous method.
- Parameters
-
aUsername | The username. |
aPassword | The password. |
aResource | The device to be logged out of. You can get the logged in devices through getLoggedInDevicesFromServerWithUsername . |
aCompletionBlock | The completion block, which contains the error message if the method fails. |
◆ log:
- (void) log: |
|
(NSString *_Nonnull) |
aLog |
|
Output log info to log file. You can call this method after the SDK has been initialized.
This is a synchronous method and blocks the current thread.
- Parameters
-
◆ loginWithUsername:agoraToken:
- (AgoraChatError *_Nullable) loginWithUsername: |
|
(NSString *_Nonnull) |
aUsername |
agoraToken: |
|
(NSString *_Nonnull) |
aAgoraToken |
|
|
| |
A user logs in to the chat server with Agora Chat user token. Supports automatic login.
This is a synchronous method and blocks the current thread.
- Parameters
-
aUsername | The username. |
aAgoraToken | The Agora Chat user token. |
- Returns
- Returns nil on success, and the description of the issue that cause the call to fail.
◆ loginWithUsername:agoraToken:completion:
- (void) loginWithUsername: |
|
(NSString *_Nonnull) |
aUsername |
agoraToken: |
|
(NSString *_Nonnull) |
aAgoraToken |
completion: |
|
(void(^)(NSString *_Nonnull aUsername, AgoraChatError *_Nullable aError)) |
aCompletionBlock |
|
|
| |
A user logs in to the chat server with Agora Chat user token. Supports automatic login.
- Parameters
-
aUsername | The username. |
aAgoraToken | The Agora Chat user token. |
aCompletionBlock | The callback of completion block, which contains the description of the cause to the issue if the method fails. |
◆ loginWithUsername:password:
- (AgoraChatError *_Nullable) loginWithUsername: |
|
(NSString *_Nonnull) |
aUsername |
password: |
|
(NSString *_Nonnull) |
aPassword |
|
|
| |
A user logs in to the chat server with a password.
This is a synchronous method and blocks the current thread.
- Parameters
-
aUsername | The username. The maximum length is 64 characters. Ensure that you set this parameter. Supported characters include the 26 English letters (a-z), the ten numbers (0-9), the underscore (_), the hyphen (-), and the English period (.). This parameter is case insensitive, and upper-case letters are automatically changed to low-case ones. If you want to set this parameter as a regular expression, set it as ^[a-zA-Z0-9_-]+$. |
aPassword | The password. The maximum length is 64 characters. Ensure that you set this parameter. |
- Returns
- Returns nil on success, and the description of the issue that cause the call to fail.
◆ loginWithUsername:password:completion:
- (void) loginWithUsername: |
|
(NSString *_Nonnull) |
aUsername |
password: |
|
(NSString *_Nonnull) |
aPassword |
completion: |
|
(void(^)(NSString *_Nonnull aUsername, AgoraChatError *_Nullable aError)) |
aCompletionBlock |
|
|
| |
A user logs in to the chat server with a password.
This is an asynchronous method.
- Parameters
-
aUsername | The username. The maximum length is 64 characters. Ensure that you set this parameter. Supported characters include the 26 English letters (a-z), the ten numbers (0-9), the underscore (_), the hyphen (-), and the English period (.). This parameter is case insensitive, and upper-case letters are automatically changed to low-case ones. If you want to set this parameter as a regular expression, set it as ^[a-zA-Z0-9_-]+$. |
aPassword | The password. The maximum length is 64 characters. Ensure that you set this parameter. |
aCompletionBlock | The completion block, which contains the username and the error message if the method fails. |
◆ loginWithUsername:token:
- (AgoraChatError *_Nullable) loginWithUsername: |
|
(NSString *_Nonnull) |
aUsername |
token: |
|
(NSString *_Nonnull) |
aToken |
|
|
| |
A user logs in to the chat server with a token. This method does not support automatic isLoggedIn.
This is a synchronous method and blocks the current thread.
- Parameters
-
aUsername | The username. The maximum length is 64 characters. Ensure that you set this parameter. Supported characters include the 26 English letters (a-z), the ten numbers (0-9), the underscore (_), the hyphen (-), and the English period (.). This parameter is case insensitive, and upper-case letters are automatically changed to low-case ones. If you want to set this parameter as a regular expression, set it as ^[a-zA-Z0-9_-]+$. |
aToken | The token for user logging in to Chat server. |
- Returns
- Returns nil on success, and the description of the issue that cause the call to fail.
◆ loginWithUsername:token:completion:
- (void) loginWithUsername: |
|
(NSString *_Nonnull) |
aUsername |
token: |
|
(NSString *_Nonnull) |
aToken |
completion: |
|
(void(^)(NSString *_Nonnull aUsername, AgoraChatError *_Nullable aError)) |
aCompletionBlock |
|
|
| |
A user logs in to the chat server with a token. This method support automatic login.
This is an asynchronous method.
- Parameters
-
aUsername | The username. The maximum length is 64 characters. Ensure that you set this parameter. Supported characters include the 26 English letters (a-z), the ten numbers (0-9), the underscore (_), the hyphen (-), and the English period (.). This parameter is case insensitive, and upper-case letters are automatically changed to low-case ones. If you want to set this parameter as a regular expression, set it as ^[a-zA-Z0-9_-]+$. |
aToken | The token for logging in to the chat server. |
aCompletionBlock | The completion block, which contains the username and the error message if the method fails. |
◆ logout:
A user logs out of the chat server.
This is a synchronous method and blocks the current thread.
- Parameters
-
aIsUnbindDeviceToken | Whether to unbind the username from the device(Set to YES to unbind the user currently logged into the app from this device). That stops the user device receiving push notifications from the Apple Push Notifications service. |
- Returns
- A description of the issue that caused this call to fail.
◆ logout:completion:
- (void) logout: |
|
(BOOL) |
aIsUnbindDeviceToken |
completion: |
|
(void(^)(AgoraChatError *_Nullable aError)) |
aCompletionBlock |
|
|
| |
A user logs out of the chat server.
This is an asynchronous method.
- Parameters
-
aIsUnbindDeviceToken | Whether to unbind the username from the device. If you unbind the username from the device (setting this parameter as YES) and logs out, the device no longer receives messages from the Apple Push Notification Service. |
aCompletionBlock | The completion block, which contains the token and the error message if the method fails. |
◆ migrateDatabaseToLatestSDK
- (BOOL) migrateDatabaseToLatestSDK |
|
|
|
Migrate the chat database to the latest SDK version.
This is a synchronous method and blocks the current thread.
- Returns
- Returns YES for success and the description of the cause if the method fails.
◆ registerForRemoteNotificationsWithDeviceToken:completion:
- (void) registerForRemoteNotificationsWithDeviceToken: |
|
(NSData *_Nonnull) |
aDeviceToken |
completion: |
|
(void(^)(AgoraChatError *_Nullable aError)) |
aCompletionBlock |
|
|
| |
Device token binding is required to enable Apple push notification service.
- Parameters
-
aDeviceToken | The device token to bind. |
aCompletionBlock | The completion block, which contains the error message if the method fails. |
◆ registerPushKitToken:completion:
- (void) registerPushKitToken: |
|
(NSData *_Nullable) |
aPushToken |
completion: |
|
(void(^)(AgoraChatError *_Nullable aError)) |
aCompletionBlock |
|
|
| |
Register a pushkit token, this is required to enable Apple PushKit Service, which is for VOIP CALL.
This is an asynchronous method.
- Parameters
-
aPushToken | The pushkit token to bind. |
aCompletionBlock | The completion block, which contains the error message if the method fails. |
◆ registerWithUsername:password:
- (AgoraChatError *_Nullable) registerWithUsername: |
|
(NSString *_Nonnull) |
aUsername |
password: |
|
(NSString *_Nonnull) |
aPassword |
|
|
| |
Register a new user with your chat network.
After you call initializeSDKWithOptions
and register your app in console, the app has access to all the features registered inside your chat network. You add and remove users inside your chat network; depending on how you implement your app, you control the people each user can see inside your network.
This is a synchronous method and blocks the current thread. To ensure registration reliability, we recommend using the REST API to register new chat users.
- Parameters
-
aUsername | The username. The maximum length is 64 characters. Ensure that you set this parameter. Supported characters include the 26 English letters (a-z), the ten numbers (0-9), the underscore (_), the hyphen (-), and the English period (.). This parameter is case insensitive, and upper-case letters are automatically changed to low-case ones. If you want to set this parameter as a regular expression, set it as ^[a-zA-Z0-9_-]+$. |
aPassword | The password. The maximum length is 64 characters. Ensure that you set this parameter. |
- Returns
- A description of the issue that caused this call to fail.
◆ registerWithUsername:password:completion:
- (void) registerWithUsername: |
|
(NSString *_Nonnull) |
aUsername |
password: |
|
(NSString *_Nonnull) |
aPassword |
completion: |
|
(void(^)(NSString *_Nonnull aUsername, AgoraChatError *_Nullable aError)) |
aCompletionBlock |
|
|
| |
Register a new user with your chat network.
This is an asynchronous method.
After you call initializeSDKWithOptions
and register your app in console, the app has access to all the features registered inside your chat network. You add and remove users inside your chat network; depending on how you implement your app, you control the people each user can see inside your network.
To ensure registration reliability, we recommend using the REST API to register new chat users.
- Parameters
-
aUsername | The username. The maximum length is 64 characters. Ensure that you set this parameter. Supported characters include the 26 English letters (a-z), the ten numbers (0-9), the underscore (_), the hyphen (-), and the English period (.). This parameter is case insensitive, and upper-case letters are automatically changed to low-case ones. If you want to set this parameter as a regular expression, set it as ^[a-zA-Z0-9_-]+$. |
aPassword | The password. The maximum length is 64 characters. Ensure that you set this parameter. |
aCompletionBlock | The completion block, which contains the username and the error message if the method fails. |
◆ removeDelegate:
- (void) removeDelegate: |
|
(id _Nonnull) |
aDelegate |
|
Remove the delegate.
- Parameters
-
aDelegate | The delegate that you want to remove. |
◆ removeLogDelegate:
- (void) removeLogDelegate: |
|
(removeLog(delegate:)) |
NS_SWIFT_NAME |
|
Remove the log callback delegate.
- Parameters
-
aDelegate | The log callback delegate that you want to delete. |
◆ removeMultiDevicesDelegate:
Remove the multi-device delegate.
- Parameters
-
aDelegate | The multi-device delegate that you want to delete. |
◆ renewToken:
- (AgoraChatError *_Nullable) renewToken: |
|
(NSString *_Nonnull) |
newAgoraToken |
|
Renews the token when the current token expires.
The token expires after a period of time once the token schema is enabled when:
- The SDK triggers the onTokenPrivilegeWillExpire callback, or
- The onConnectionStateChanged callback reports the CONNECTION_CHANGED_TOKEN_EXPIRED(9) error.
The app should retrieve a new token from the server and call this method to renew it. Failure to do so results in the SDK disconnecting from the server.
This is a synchronous method and blocks the current thread.
- Parameters
-
newAgoraToken | The new Agora Chat token。 |
- Returns
- The result which contains the description of the cause to the failure if call fails.
◆ serviceCheckWithUsername:password:completion:
- (void) serviceCheckWithUsername: |
|
(NSString *_Nonnull) |
aUsername |
password: |
|
(NSString *_Nonnull) |
aPassword |
completion: |
|
(void(^)(AgoraChatServerCheckType aType, AgoraChatError *_Nullable aError)) |
aCompletionBlock |
|
|
| |
Run the server diagnostic tests for Agora Chat for a specific user. These tests are run in the order defined by AgoraChatServerCheckType. If the user is logged in, the login account is used by default.
This is an asynchronous method.
- Parameters
-
aUsername | The username. |
aPassword | The password. |
aCompletionBlock | The completion block, which contains the error message if the method fails. |
◆ sharedClient
+ (instancetype _Nonnull) sharedClient |
|
|
|
Creates a Client instance. The Client class is the entry to the Chat SDK. You need to call this method to create a Client instance before calling any other method.
◆ unBindPushKitToken
Unbind the Apple PushKit token.
This is a synchronous method and blocks the current thread.
- Returns
- A description of the issue that caused this call to fail.
◆ unRegisterPushKitTokenWithCompletion:
- (void) unRegisterPushKitTokenWithCompletion: |
|
(void(^)(AgoraChatError *_Nullable aError)) |
aCompletionBlock |
|
Unregister the Apple PushKit token.
- Parameters
-
aCompletionBlock | The completion block, which contains the error message if the method fails. |
◆ uploadDebugLogToServerWithCompletion:
- (void) uploadDebugLogToServerWithCompletion: |
|
(void(^)(AgoraChatError *_Nullable aError)) |
aCompletionBlock |
|
Upload debugging log to server.
- Parameters
-
aCompletionBlock | The completion block, which contains the token and the error message if the method fails. |
◆ uploadLogToServer
Upload the log to the chat server. The information in the debug log is used by our engineers to fix errors and improve system performance. Make sure to use the AgoraChatLog
class.
This is a synchronous method and blocks the current thread.
- Returns
- Returns nil on success, and error on failure which contains the description of the issue that cause the call to fail_Nullable.
◆ version
◆ accessUserToken
- (NSString* _Nullable) accessUserToken |
|
readnonatomicassign |
The token for accessing the current chat.
◆ chatManager
◆ contactManager
The contact manager module.
◆ currentUsername
- (NSString* _Nullable) currentUsername |
|
readnonatomicstrong |
The ID of the user currently logged into your chat app.
◆ groupManager
The group manager module.
◆ isAutoLogin
Whether to let a user automatically log in to the chat server with the username used in the previous session. If the login fails, for example, because of a wrong password or the username deactivated, the isAutoLogin parameter is reset to NO, and you need to set it back to YES to allow automatic login.
◆ isConnected
Whether the SDK is connected to the chat server.
◆ isLoggedIn
Returns true
if the current user is logged in.
◆ options
The SDK setting options. For example, whether to use https by default.
◆ presenceManager
The presence manager module.
◆ pushManager
◆ roomManager
The chat room manager module.
◆ threadManager
◆ userInfoManager
The user attributes manager module.
◆ version
- (NSString* _Nonnull) version |
|
readnonatomicstrong |
The documentation for this class was generated from the following file: