agora_chat_SDK  3.8.2
Instance Methods | Class Methods | Protected Attributes | Properties | List of all members
AgoraChatClient Class Reference

#import <AgoraChatClient.h>

Inheritance diagram for AgoraChatClient:

Instance Methods

(void) - addDelegate:delegateQueue:
 
(void) - removeDelegate:
 
(void) - addMultiDevicesDelegate:delegateQueue:
 
(void) - removeMultiDevicesDelegate:
 
(AgoraError *) - initializeSDKWithOptions:
 
(AgoraError *) - changeAppkey:
 
(AgoraError *) - registerWithUsername:password:
 
(void) - registerWithUsername:password:completion:
 
(void) - fetchTokenWithUsername:password:completion:
 
(AgoraError *) - loginWithUsername:password:
 
(void) - loginWithUsername:password:completion:
 
(AgoraError *) - loginWithUsername:token:
 
(void) - loginWithUsername:token:completion:
 
(AgoraError *) - logout:
 
(void) - logout:completion:
 
(AgoraError *) - bindPushKitToken:
 
(void) - registerPushKitToken:completion:
 
(AgoraError *) - unBindPushKitToken
 
(void) - unRegisterPushKitTokenWithCompletion:
 
(AgoraError *) - bindDeviceToken:
 
(void) - registerForRemoteNotificationsWithDeviceToken:completion:
 
(AgoraError *) - uploadLogToServer
 
(void) - uploadDebugLogToServerWithCompletion:
 
(NSString *) - getLogFilesPath:
 
(void) - getLogFilesPathWithCompletion:
 
(void) - log:
 
(NSArray *) - getLoggedInDevicesFromServerWithUsername:password:error:
 
(void) - getLoggedInDevicesFromServerWithUsername:password:completion:
 
(AgoraError *) - kickDeviceWithUsername:password:resource:
 
(void) - kickDeviceWithUsername:password:resource:completion:
 
(AgoraError *) - kickAllDevicesWithUsername:password:
 
(void) - kickAllDevicesWithUsername:password:completion:
 
(BOOL) - migrateDatabaseToLatestSDK
 
(void) - applicationDidEnterBackground:
 
(void) - applicationWillEnterForeground:
 
(void) - application:didReceiveRemoteNotification:
 
(void) - serviceCheckWithUsername:password:completion:
 
(AgoraPushOptions *pushOptions) - EM_DEPRECATED_IOS
 
(AgoraError *) - setApnsNickname:
 
(void) - updatePushNotifiationDisplayName:completion:
 
(AgoraPushOptions *) - getPushOptionsFromServerWithError:
 
(void) - getPushNotificationOptionsFromServerWithCompletion:
 
(3_1_0, 3_7_2,"") - EM_DEPRECATED_IOS
 
(void) - updatePushNotificationOptionsToServerWithCompletion:
 
(void) - addDelegate:
 
(void) - asyncRegisterWithUsername:password:success:failure:
 
(void) - asyncLoginWithUsername:password:success:failure:
 
(void) - asyncLogout:success:failure:
 
(void) - asyncBindDeviceToken:success:failure:
 
(void) - asyncSetApnsNickname:success:failure:
 
(void) - asyncGetPushOptionsFromServer:failure:
 
(void) - asyncUpdatePushOptionsToServer:failure:
 
(void) - asyncUploadLogToServer:failure:
 
(3_1_0, 3_2_2,"Use -migrateDatabaseToLatestSDK instead") - EM_DEPRECATED_IOS
 
(AgoraError *) - kickDevice:username:password:
 
(void) - kickDevice:username:password:completion:
 

Class Methods

(instancetype) + sharedClient
 

Protected Attributes

AgoraPushOptions_pushOptions
 

Properties

NSString * version
 
NSString * currentUsername
 
AgoraOptionsoptions
 
id< IAgoraChatManagerchatManager
 
id< IAgoraContactManagercontactManager
 
id< IAgoraGroupManagergroupManager
 
id< IAgoraChatroomManagerroomManager
 
id< IAgoraPushManagerpushManager
 
BOOL isAutoLogin
 
BOOL isLoggedIn
 
BOOL isConnected
 
NSString * accessUserToken
 
id< IAgoraUserInfoManageruserInfoManager
 

Detailed Description

IM SDK Client, entrance of SDK, used to login, logout, and get access IM modules, such as [AgoraChatClient sharedClient].groupManager;

Method Documentation

- (void) addDelegate: (3_1_0) 
(3_2_2) 
("Use - instead")  EM_DEPRECATED_IOS[IEMCallManager addDelegate:delegateQueue:] 

Add delegate

Parameters
aDelegateDelegate
- (void) addDelegate: (id< AgoraChatClientDelegate >)  aDelegate
delegateQueue: (dispatch_queue_t)  aQueue 

Add delegate

Parameters
aDelegateDelegate
aQueue(optional) The queue of calling delegate methods. Pass in nil to run on main thread.
- (void) addMultiDevicesDelegate: (id< AgoraMultiDevicesDelegate >)  aDelegate
delegateQueue: (dispatch_queue_t)  aQueue 

Add multi-device delegate

Parameters
aDelegateDelegate
aQueueThe queue of calling delegate methods
- (void) application: (id)  application
didReceiveRemoteNotification: (NSDictionary *)  userInfo 

Invoked when receiving APNS in foreground

Parameters
applicationUIApplication
userInfoPush content
- (void) applicationDidEnterBackground: (id)  aApplication

Disconnect from server when app enters background

Parameters
aApplicationUIApplication
- (void) applicationWillEnterForeground: (id)  aApplication

Reconnect to server when app enters foreground

Parameters
aApplicationUIApplication
- (void) asyncBindDeviceToken: (NSData *)  aDeviceToken
success: (void(^)())  aSuccessBlock
failure: (3_1_0) 
(3_2_2) 
("Use -registerForRemoteNotificationsWithDeviceToken:completion: instead")  EM_DEPRECATED_IOS 

Bind device token

Parameters
aDeviceTokenDevice token to bind
aSuccessBlockThe callback block of success
aFailureBlockThe callback block of failure
- (void) asyncGetPushOptionsFromServer: (void(^)(AgoraPushOptions *aOptions))  aSuccessBlock
failure: (3_1_0) 
(3_2_2) 
("Use -getPushOptionsFromServerWithCompletion: instead")  EM_DEPRECATED_IOS 

Get apns options from the server

Parameters
aSuccessBlockThe callback block of success
aFailureBlockThe callback block of failure
- (void) asyncLoginWithUsername: (NSString *)  aUsername
password: (NSString *)  aPassword
success: (void(^)())  aSuccessBlock
failure: (3_1_0) 
(3_2_2) 
("Use -loginWithUsername:password:completion: instead")  EM_DEPRECATED_IOS 

Login

Parameters
aUsernameUsername
aPasswordPassword
aSuccessBlockThe callback block of success
aFailureBlockThe callback block of failure
- (void) asyncLogout: (BOOL)  aIsUnbindDeviceToken
success: (void(^)())  aSuccessBlock
failure: (3_1_0) 
(3_2_2) 
("Use -logout:completion: instead")  EM_DEPRECATED_IOS 

Logout

Parameters
aIsUnbindDeviceTokenUnbind device token to disable the Apple Push Notification Service
aSuccessBlockThe callback block of success
aFailureBlockThe callback block of failure
- (void) asyncRegisterWithUsername: (NSString *)  aUsername
password: (NSString *)  aPassword
success: (void(^)())  aSuccessBlock
failure: (3_1_0) 
(3_2_2) 
("Use -registerWithUsername:password:completion: instead")  EM_DEPRECATED_IOS 

Register a new user

To enhance the reliability, registering new IM user through REST API from backend is highly recommended

Parameters
aUsernameUsername
aPasswordPassword
aSuccessBlockThe callback block of success
aFailureBlockThe callback block of failure
- (void) asyncSetApnsNickname: (NSString *)  aNickname
success: (void(^)())  aSuccessBlock
failure: (3_1_0) 
(3_2_2) 
("Use -updatePushNotifiationDisplayName:copletion: instead")  EM_DEPRECATED_IOS 

Set display name for push notification

Parameters
aNicknamePush Notification display name
aSuccessBlockThe callback block of success
aFailureBlockThe callback block of failure
- (void) asyncUpdatePushOptionsToServer: (void(^)())  aSuccessBlock
failure: (3_1_0) 
(3_2_2) 
("Use -updatePushNotificationOptionsToServerWithCompletion: instead")  EM_DEPRECATED_IOS 

Update APNS options to the server

Parameters
aSuccessBlockThe callback block of success
aFailureBlockThe callback block of failure
- (void) asyncUploadLogToServer: (void(^)())  aSuccessBlock
failure: (3_1_0) 
(3_2_2) 
("Use -uploadDebugLogToServerWithCompletion: instead")  EM_DEPRECATED_IOS 

Upload log to server

Parameters
aSuccessBlockThe callback block of success
aFailureBlockThe callback block of failure
- (AgoraError *) bindDeviceToken: (NSData *)  aDeviceToken

Device token binding is required to enable Apple Push Notification Service

Synchronization method will block the current thread

Parameters
aDeviceTokenDevice token to bind
Returns
AgoraError error
- (AgoraError *) bindPushKitToken: (NSData *)  aPushToken

Pushkit token binding is required to enable Apple PushKit Service

Synchronization method will block the current thread

Parameters
aPushTokenpushkit token to bind
Returns
AgoraError error
- (AgoraError *) changeAppkey: (NSString *)  aAppkey

Change appkey. Can only change appkey when the user is logged out

Parameters
aAppkeyappkey
Returns
AgoraError error
- (3_1_0, 3_2_2, "Use -migrateDatabaseToLatestSDK instead") EM_DEPRECATED_IOS

iOS-specific, data migration to SDK3.0

Synchronization method will block the current thread

It's needed to call this method when update to SDK3.0, developers need to wait this method complete before DB related operations

Returns
Whether migration successful
- (AgoraPushOptions* pushOptions) EM_DEPRECATED_IOS (3_1_0) 
(3_7_2) 
("Use - instead")  [IAgoraPushManager.pushOptions] 

Apple Push Notification Service setting

- (3_1_0, 3_7_2, "") EM_DEPRECATED_IOS

Update Apple Push Notification Service options to the server

Synchronization method will block the current thread

Returns
AgoraError error
- (void) fetchTokenWithUsername: (NSString *)  aUsername
password: (NSString *)  aPassword
completion: (void(^)(NSString *aToken, AgoraError *aError))  aCompletionBlock 

Get the token from the server

Parameters
aUsernameUsername
aPasswordPassword
aCompletionBlockThe callback of completion block
- (NSString *) getLogFilesPath: (AgoraError **)  pError

Compress the log file into a .gz file and return the gz file path. Recommend delete the gz file if file is no longer used

Synchronization method will block the current thread

Parameters
pErrorError
Returns
NSString Filepath
- (void) getLogFilesPathWithCompletion: (void(^)(NSString *aPath, AgoraError *aError))  aCompletionBlock

Compress the log file into a .gz file and return the gz file path. Recommend delete the gz file if file is no longer used

Parameters
aCompletionBlockThe callback of completion block
- (void) getLoggedInDevicesFromServerWithUsername: (NSString *)  aUsername
password: (NSString *)  aPassword
completion: (void(^)(NSArray *aList, AgoraError *aError))  aCompletionBlock 

Get all the device information <AgoraDeviceConfig> that logged in to the server

Parameters
aUsernameUsername
aPasswordPassword
aCompletionBlockThe callback block of completion
- (NSArray *) getLoggedInDevicesFromServerWithUsername: (NSString *)  aUsername
password: (NSString *)  aPassword
error: (AgoraError **)  pError 

Get all the device information <AgoraDeviceConfig> that logged in to the server

Synchronization method will block the current thread

Parameters
aUsernameUsername
aPasswordPassword
pErrorError
Returns
NSArray Information of logged in device <AgoraDeviceConfig>
- (void) getPushNotificationOptionsFromServerWithCompletion: (3_1_0) 
(3_7_2) 
("Use - instead")  EM_DEPRECATED_IOS[IAgoraPushManager:getPushNotificationOptionsFromServerWithCompletion:] 

Get Apple Push Notification Service options from the server

Parameters
aCompletionBlockThe callback of completion block
- (AgoraPushOptions *) getPushOptionsFromServerWithError: (3_1_0) 
(3_7_2) 
("Use - instead")  EM_DEPRECATED_IOS[IAgoraPushManager:getPushOptionsFromServerWithError:] 

Get Apple Push Notification Service options from the server

Synchronization method will block the current thread

Parameters
pErrorError
Returns
AgoraPushOptions Apple Push Notification Service options
- (AgoraError *) initializeSDKWithOptions: (AgoraOptions *)  aOptions

Initialize the SDK

Parameters
aOptionsSDK setting options
Returns
AgoraError error
- (AgoraError *) kickAllDevicesWithUsername: (NSString *)  aUsername
password: (NSString *)  aPassword 

Force logout all logged in device for the specified user

Synchronization method will block the current thread

Parameters
aUsernameUsername
aPasswordPassword
Returns
AgoraError error
- (void) kickAllDevicesWithUsername: (NSString *)  aUsername
password: (NSString *)  aPassword
completion: (void(^)(AgoraError *aError))  aCompletionBlock 

Force all logged in device to logout.

Parameters
aUsernameUsername
aPasswordPassword
aCompletionBlockThe callback block of completion
- (AgoraError *) kickDevice: (AgoraDeviceConfig *)  aDevice
username: (NSString *)  aUsername
password: (3_1_0) 
(3_2_2) 
("Use - kickDeviceWithUsername:password:resource: instead")  EM_DEPRECATED_IOS 

Force logout the specified device

device information can be obtained from getLoggedInDevicesFromServerWithUsername:password:error:

Synchronization method will block the current thread

Parameters
aDevicedevice information <AgoraDeviceConfig>
aUsernameUsername
aPasswordPassword
Returns
AgoraError error
- (void) kickDevice: (AgoraDeviceConfig *)  aDevice
username: (NSString *)  aUsername
password: (NSString *)  aPassword
completion: (3_1_0) 
(3_2_2) 
("Use - kickDeviceWithUsername:password:resource:completion: instead")  EM_DEPRECATED_IOS 

Force logout the specified device

device information can be obtained from getLoggedInDevicesFromServerWithUsername:password:error:

Parameters
aDevicedevice information <AgoraDeviceConfig>
aUsernameUsername
aPasswordPassword
aCompletionBlockThe callback block of completion
- (AgoraError *) kickDeviceWithUsername: (NSString *)  aUsername
password: (NSString *)  aPassword
resource: (NSString *)  aResource 

Force logout the specified device

device information can be obtained from getLoggedInDevicesFromServerWithUsername:password:error:

Synchronization method will block the current thread

Parameters
aUsernameUsername
aPasswordPassword
aResourcedevice resource
Returns
Error
- (void) kickDeviceWithUsername: (NSString *)  aUsername
password: (NSString *)  aPassword
resource: (NSString *)  aResource
completion: (void(^)(AgoraError *aError))  aCompletionBlock 

Force logout the specified device

device information can be obtained from getLoggedInDevicesFromServerWithUsername:password:error:

Parameters
aUsernameUsername
aPasswordPassword
aResourcedevice resource
aCompletionBlockThe callback block of completion
- (void) log: (NSString *)  aLog

Output log info to log file.You can call this method after the SDK has been initialized.

Parameters
aLogThe log info
- (AgoraError *) loginWithUsername: (NSString *)  aUsername
password: (NSString *)  aPassword 

Login with password

Synchronization method will block the current thread

Parameters
aUsernameUsername It cannot be empty, it can be letters/numbers/underscores/horizontals/periods. The regular expression is "^[a-zA-Z0-9_-]+$". Nothing else is allowed. If it is an uppercase letter, it will be automatically converted to lowercase. The length cannot exceed 64 characters in length
aPasswordPassword Cannot be empty, and the length cannot exceed 64 characters in length
Returns
AgoraError error
- (void) loginWithUsername: (NSString *)  aUsername
password: (NSString *)  aPassword
completion: (void(^)(NSString *aUsername, AgoraError *aError))  aCompletionBlock 

Login with password

Parameters
aUsernameUsername
aPasswordPassword
aCompletionBlockThe callback of completion block
- (AgoraError *) loginWithUsername: (NSString *)  aUsername
token: (NSString *)  aToken 

Login with token. Does not support automatic login

Synchronization method will block the current thread

Parameters
aUsernameUsername
aTokenToken
Returns
AgoraError error
- (void) loginWithUsername: (NSString *)  aUsername
token: (NSString *)  aToken
completion: (void(^)(NSString *aUsername, AgoraError *aError))  aCompletionBlock 

Login with token. Does not support automatic login

Parameters
aUsernameUsername
aTokenToken
aCompletionBlockThe callback of completion block
- (AgoraError *) logout: (BOOL)  aIsUnbindDeviceToken

Logout

Synchronization method will block the current thread

Parameters
aIsUnbindDeviceTokenUnbind device token to disable Apple Push Notification Service
Returns
AgoraError error
- (void) logout: (BOOL)  aIsUnbindDeviceToken
completion: (void(^)(AgoraError *aError))  aCompletionBlock 

Logout

Parameters
aIsUnbindDeviceTokenWhether to unbind the device token, the device will no longer receive push notifications after unbinding, If YES is passed in, unbinding fails and error will be returned
aCompletionBlockThe callback of completion block
- (BOOL) migrateDatabaseToLatestSDK

Migrate the IM database to the latest SDK version

Synchronization method will block the current thread

Returns
BOOL Return YES for success
- (void) registerForRemoteNotificationsWithDeviceToken: (NSData *)  aDeviceToken
completion: (void(^)(AgoraError *aError))  aCompletionBlock 

Device token binding is required to enable Apple push notification service

Parameters
aDeviceTokenDevice token to bind
aCompletionBlockThe callback block of completion
- (void) registerPushKitToken: (NSData *)  aPushToken
completion: (void(^)(AgoraError *aError))  aCompletionBlock 

Pushkit token binding is required to enable Apple PushKit Service

Parameters
aPushTokenpushkit token to bind
aCompletionBlockThe callback block of completion
- (AgoraError *) registerWithUsername: (NSString *)  aUsername
password: (NSString *)  aPassword 

Register a new IM user

To ensure good reliability, registering new IM user via REST API from developer backend is highly recommended

Parameters
aUsernameUsername
aPasswordPassword
Returns
AgoraError error
- (void) registerWithUsername: (NSString *)  aUsername
password: (NSString *)  aPassword
completion: (void(^)(NSString *aUsername, AgoraError *aError))  aCompletionBlock 

Register a new IM user

To ensure good reliability, registering new IM user via REST API from developer backend is highly recommended

Parameters
aUsernameUsername
aPasswordPassword
aCompletionBlockThe callback of completion block
- (void) removeDelegate: (id)  aDelegate

Remove delegate

Parameters
aDelegateDelegate
- (void) removeMultiDevicesDelegate: (id< AgoraMultiDevicesDelegate >)  aDelegate

Remove multi devices delegate

Parameters
aDelegateDelegate
- (void) serviceCheckWithUsername: (NSString *)  aUsername
password: (NSString *)  aPassword
completion: (void(^)(AgoraServerCheckType aType, AgoraError *aError))  aCompletionBlock 

Make a diagnose for service, Diagnosis of current services according to the order of AgoraServerCheckType enumeration, and callback for the developer If you have logged in, use the default login account

Parameters
aUsernameusername
aPasswordpassword
aCompletionBlockThe callback block of completion
- (AgoraError *) setApnsNickname: (3_1_0) 
(3_7_2) 
("Use - instead")  EM_DEPRECATED_IOS[IAgoraPushManager:setApnsNickname:] 

Set display name for Apple Push Notification message

Synchronization method will block the current thread

Parameters
aNicknameDisplay name
Returns
Error
+ (instancetype) sharedClient

Get SDK singleton instance

- (AgoraError *) unBindPushKitToken

Disable Apple PushKit Service

Synchronization method will block the current thread

Returns
AgoraError error
- (void) unRegisterPushKitTokenWithCompletion: (void(^)(AgoraError *aError))  aCompletionBlock

Disable Apple PushKit Service

Parameters
aCompletionBlockThe callback block of completion
- (void) updatePushNotifiationDisplayName: (NSString *)  aDisplayName
completion: (3_1_0) 
(3_7_2) 
("Use - instead")  EM_DEPRECATED_IOS[IAgoraPushManager:updatePushNotifiationDisplayName:completion:] 

Set display name for the push notification

Parameters
aDisplayNameDisplay name of push
aCompletionBlockThe callback block of completion
- (void) updatePushNotificationOptionsToServerWithCompletion: (3_1_0) 
(3_7_2) 
("")  EM_DEPRECATED_IOS 

Update Apple Push Notification Service options to the server

Parameters
aCompletionBlockThe callback block of completion
- (void) uploadDebugLogToServerWithCompletion: (void(^)(AgoraError *aError))  aCompletionBlock

Upload debugging log to server

Parameters
aCompletionBlockThe callback of completion block
- (AgoraError *) uploadLogToServer

Upload debugging log to server

Synchronization method will block the current thread

Returns
AgoraError error

Property Documentation

- (NSString*) accessUserToken
readnonatomicassign

Current user hyphenate token

- (id<IAgoraChatManager>) chatManager
readnonatomicstrong

Chat Management

- (id<IAgoraContactManager>) contactManager
readnonatomicstrong

Contact Management

- (NSString*) currentUsername
readnonatomicstrong

Current logged in user's username

- (id<IAgoraGroupManager>) groupManager
readnonatomicstrong

Group Management

- (BOOL) isAutoLogin
readnonatomicassign

If SDK will automatically log into with previously logged in session. If the current login failed, then isAutoLogin attribute will be reset to NO, you need to set it back to YES in order to allow automatic login

  1. password changed
  2. deactivate, forced logout, etc
- (BOOL) isConnected
readnonatomicassign

Whether connection to Hyphenate IM server

- (BOOL) isLoggedIn
readnonatomicassign

If a user logged in

- (AgoraOptions*) options
readnonatomicstrong

SDK setting options

- (id<IAgoraPushManager>) pushManager
readnonatomicstrong

push Management

- (id<IAgoraChatroomManager>) roomManager
readnonatomicstrong

Chat Room Management

- (id<IAgoraUserInfoManager>) userInfoManager
readnonatomicstrong

User attribute related

- (NSString*) version
readnonatomicstrong

SDK version


The documentation for this class was generated from the following file: