12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151 |
- /*!
- * @header EMClient.h
- * @abstract SDK Client
- * @author Hyphenate
- * @version 3.00
- */
- #import <Foundation/Foundation.h>
- #import "EMClientDelegate.h"
- #import "EMMultiDevicesDelegate.h"
- #import "EMOptions.h"
- #import "EMPushOptions.h"
- #import "EMError.h"
- #import "IEMChatManager.h"
- #import "IEMContactManager.h"
- #import "IEMGroupManager.h"
- #import "IEMChatroomManager.h"
- #import "EMDeviceConfig.h"
- /*!
- * \~chinese
- * 服务检查类型
- *
- * \~english
- * Type of server check
- */
- typedef enum {
- EMServerCheckAccountValidation = 0, /*! \~chinese 账号检查 \~english Valid account */
- EMServerCheckGetDNSListFromServer, /*! \~chinese 获取服务列表检查 \~english Check get dns from server */
- EMServerCheckGetTokenFromServer, /*! \~chinese 获取token检查 \~english Check get token from server */
- EMServerCheckDoLogin, /*! \~chinese 登录检查 \~english Check login mode */
- EMServerCheckDoLogout, /*! \~chinese 登出检查 \~english Check logout mode */
- } EMServerCheckType;
- /*!
- * SDK Client
- */
- @interface EMClient : NSObject
- {
- EMPushOptions *_pushOptions;
- }
- /*!
- * \~chinese
- * SDK版本号
- *
- * \~english
- * SDK version
- */
- @property (nonatomic, strong, readonly) NSString *version;
- /*!
- * \~chinese
- * 当前登录账号
- *
- * \~english
- * Current logged in user's username
- */
- @property (nonatomic, strong, readonly) NSString *currentUsername;
- /*!
- * \~chinese
- * SDK属性
- *
- * \~english
- * SDK setting options
- */
- @property (nonatomic, strong, readonly) EMOptions *options;
- /*!
- * \~chinese
- * 推送设置
- *
- * \~english
- * Apple Push Notification Service setting
- */
- @property (nonatomic, strong, readonly) EMPushOptions *pushOptions;
- /*!
- * \~chinese
- * 聊天模块
- *
- * \~english
- * Chat Management
- */
- @property (nonatomic, strong, readonly) id<IEMChatManager> chatManager;
- /*!
- * \~chinese
- * 好友模块
- *
- * \~english
- * Contact Management
- */
- @property (nonatomic, strong, readonly) id<IEMContactManager> contactManager;
- /*!
- * \~chinese
- * 群组模块
- *
- * \~english
- * Group Management
- */
- @property (nonatomic, strong, readonly) id<IEMGroupManager> groupManager;
- /*!
- * \~chinese
- * 聊天室模块
- *
- * \~english
- * Chat Room Management
- */
- @property (nonatomic, strong, readonly) id<IEMChatroomManager> roomManager;
- /*!
- * \~chinese
- * SDK是否自动登录上次登录的账号
- *
- * \~english
- * 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
- */
- @property (nonatomic, readonly) BOOL isAutoLogin;
- /*!
- * \~chinese
- * 用户是否已登录
- *
- * \~english
- * If a user logged in
- */
- @property (nonatomic, readonly) BOOL isLoggedIn;
- /*!
- * \~chinese
- * 是否连上聊天服务器
- *
- * \~english
- * Connection status to Hyphenate IM server
- */
- @property (nonatomic, readonly) BOOL isConnected;
- /*!
- * \~chinese
- * 获取SDK实例
- *
- * \~english
- * Get SDK singleton instance
- */
- + (instancetype)sharedClient;
- #pragma mark - Delegate
- /*!
- * \~chinese
- * 添加回调代理
- *
- * @param aDelegate 要添加的代理
- * @param aQueue 执行代理方法的队列
- *
- * \~english
- * Add delegate
- *
- * @param aDelegate Delegate
- * @param aQueue (optional) The queue of calling delegate methods. Pass in nil to run on main thread.
- */
- - (void)addDelegate:(id<EMClientDelegate>)aDelegate
- delegateQueue:(dispatch_queue_t)aQueue;
- /*!
- * \~chinese
- * 移除回调代理
- *
- * @param aDelegate 要移除的代理
- *
- * \~english
- * Remove delegate
- *
- * @param aDelegate Delegate
- */
- - (void)removeDelegate:(id)aDelegate;
- /*!
- * \~chinese
- * 注册多设备回调代理
- *
- * @param aDelegate 要添加的代理
- * @param aQueue 执行代理方法的队列
- *
- * \~english
- * Add multi-device delegate
- *
- * @param aDelegate Delegate
- * @param aQueue The queue of calling delegate methods
- */
- - (void)addMultiDevicesDelegate:(id<EMMultiDevicesDelegate>)aDelegate
- delegateQueue:(dispatch_queue_t)aQueue;
- /*!
- * \~chinese
- * 移除多设备回调代理
- *
- * @param aDelegate 要移除的代理
- *
- * \~english
- * Remove multi devices delegate
- *
- * @param aDelegate Delegate
- */
- - (void)removeMultiDevicesDelegate:(id<EMMultiDevicesDelegate>)aDelegate;
- #pragma mark - Initialize SDK
- /*!
- * \~chinese
- * 初始化sdk
- *
- * @param aOptions SDK配置项
- *
- * @result 错误信息
- *
- * \~english
- * Initialize the SDK
- *
- * @param aOptions SDK setting options
- *
- * @result Error
- */
- - (EMError *)initializeSDKWithOptions:(EMOptions *)aOptions;
- #pragma mark - Change AppKey
- /*!
- * \~chinese
- * 修改appkey,注意只有在未登录状态才能修改appkey
- *
- * @param aAppkey appkey
- *
- * @result 错误信息
- *
- * \~english
- * Change appkey. Can only change appkey when the user is logged out
- *
- * @param aAppkey appkey
- *
- * @result Error
- */
- - (EMError *)changeAppkey:(NSString *)aAppkey;
- #pragma mark - User Registeration
- /*!
- * \~chinese
- * 注册用户
- *
- * 同步方法,会阻塞当前线程. 不推荐使用,建议后台通过REST注册
- *
- * @param aUsername 用户名
- * @param aPassword 密码
- *
- * @result 错误信息
- *
- * \~english
- * Register a new IM user
- *
- * To ensure good reliability, registering new IM user via REST API from developer backend is highly recommended
- *
- * @param aUsername Username
- * @param aPassword Password
- *
- * @result Error
- */
- - (EMError *)registerWithUsername:(NSString *)aUsername
- password:(NSString *)aPassword;
- /*!
- * \~chinese
- * 注册用户
- *
- * 不推荐使用,建议后台通过REST注册
- *
- * @param aUsername 用户名
- * @param aPassword 密码
- * @param aCompletionBlock 完成的回调
- *
- * \~english
- * Register a new IM user
- *
- * To ensure good reliability, registering new IM user via REST API from developer backend is highly recommended
- *
- * @param aUsername Username
- * @param aPassword Password
- * @param aCompletionBlock The callback of completion block
- *
- */
- - (void)registerWithUsername:(NSString *)aUsername
- password:(NSString *)aPassword
- completion:(void (^)(NSString *aUsername, EMError *aError))aCompletionBlock;
- #pragma mark - Login
- /*!
- * \~chinese
- * 从服务器获取token
- *
- * @param aUsername 用户名
- * @param aPassword 密码
- * @param aCompletionBlock 完成的回调
- *
- * \~english
- * Get the token from the server
- *
- * @param aUsername Username
- * @param aPassword Password
- * @param aCompletionBlock The callback of completion block
- *
- */
- - (void)fetchTokenWithUsername:(NSString *)aUsername
- password:(NSString *)aPassword
- completion:(void (^)(NSString *aToken, EMError *aError))aCompletionBlock;
- /*!
- * \~chinese
- * 密码登录
- *
- * 同步方法,会阻塞当前线程
- *
- * @param aUsername 用户名
- * @param aPassword 密码
- *
- * @result 错误信息
- *
- * \~english
- * Login with password
- *
- * Synchronization method will block the current thread
- *
- * @param aUsername Username
- * @param aPassword Password
- *
- * @result Error
- */
- - (EMError *)loginWithUsername:(NSString *)aUsername
- password:(NSString *)aPassword;
- /*!
- * \~chinese
- * 密码登录
- *
- * @param aUsername 用户名
- * @param aPassword 密码
- * @param aCompletionBlock 完成的回调
- *
- * \~english
- * Login with password
- *
- * @param aUsername Username
- * @param aPassword Password
- * @param aCompletionBlock The callback of completion block
- *
- */
- - (void)loginWithUsername:(NSString *)aUsername
- password:(NSString *)aPassword
- completion:(void (^)(NSString *aUsername, EMError *aError))aCompletionBlock;
- /*!
- * \~chinese
- * token登录,不支持自动登录
- *
- * 同步方法,会阻塞当前线程
- *
- * @param aUsername 用户名
- * @param aToken Token
- *
- * @result 错误信息
- *
- * \~english
- * Login with token. Does not support automatic login
- *
- * Synchronization method will block the current thread
- *
- * @param aUsername Username
- * @param aToken Token
- *
- * @result Error
- */
- - (EMError *)loginWithUsername:(NSString *)aUsername
- token:(NSString *)aToken;
- /*!
- * \~chinese
- * token登录,不支持自动登录
- *
- * @param aUsername 用户名
- * @param aToken Token
- * @param aCompletionBlock 完成的回调
- *
- * \~english
- * Login with token. Does not support automatic login
- *
- * @param aUsername Username
- * @param aToken Token
- * @param aCompletionBlock The callback of completion block
- *
- */
- - (void)loginWithUsername:(NSString *)aUsername
- token:(NSString *)aToken
- completion:(void (^)(NSString *aUsername, EMError *aError))aCompletionBlock;
- #pragma mark - Logout
- /*!
- * \~chinese
- * 退出
- *
- * 同步方法,会阻塞当前线程
- *
- * @param aIsUnbindDeviceToken 是否解除device token的绑定,解除绑定后设备不会再收到消息推送
- * 如果传入YES, 解除绑定失败,将返回error
- *
- * @result 错误信息
- *
- * \~english
- * Logout
- *
- * Synchronization method will block the current thread
- *
- * @param aIsUnbindDeviceToken Unbind device token to disable Apple Push Notification Service
- *
- * @result Error
- */
- - (EMError *)logout:(BOOL)aIsUnbindDeviceToken;
- /*!
- * \~chinese
- * 退出
- *
- * @param aIsUnbindDeviceToken 是否解除device token的绑定,解除绑定后设备不会再收到消息推送
- * 如果传入YES, 解除绑定失败,将返回error
- * @param aCompletionBlock 完成的回调
- *
- * \~english
- * Logout
- *
- * @param aIsUnbindDeviceToken Unbind device token to disable the Apple Push Notification Service
- * @param aCompletionBlock The callback of completion block
- *
- */
- - (void)logout:(BOOL)aIsUnbindDeviceToken
- completion:(void (^)(EMError *aError))aCompletionBlock;
- #pragma mark - APNs
- /*!
- * \~chinese
- * 绑定device token
- *
- * 同步方法,会阻塞当前线程
- *
- * @param aDeviceToken 要绑定的token
- *
- * @result 错误信息
- *
- * \~english
- * Device token binding is required to enable Apple Push Notification Service
- *
- * Synchronization method will block the current thread
- *
- * @param aDeviceToken Device token to bind
- *
- * @result Error
- */
- - (EMError *)bindDeviceToken:(NSData *)aDeviceToken;
- /*!
- * \~chinese
- * 绑定device token
- *
- * @param aDeviceToken 要绑定的token
- * @param aCompletionBlock 完成的回调
- *
- * \~english
- * Device token binding is required to enable Apple push notification service
- *
- * @param aDeviceToken Device token to bind
- * @param aCompletionBlock The callback block of completion
- */
- - (void)registerForRemoteNotificationsWithDeviceToken:(NSData *)aDeviceToken
- completion:(void (^)(EMError *aError))aCompletionBlock;
- /*!
- * \~chinese
- * 设置推送消息显示的昵称
- *
- * 同步方法,会阻塞当前线程
- *
- * @param aNickname 要设置的昵称
- *
- * @result 错误信息
- *
- * \~english
- * Set display name for Apple Push Notification message
- *
- * Synchronization method will block the current thread
- *
- * @param aNickname Display name
- *
- * @result Error
- */
- - (EMError *)setApnsNickname:(NSString *)aNickname;
- /*!
- * \~chinese
- * 设置推送的显示名
- *
- * @param aDisplayName 推送显示名
- * @param aCompletionBlock 完成的回调
- *
- * \~english
- * Set display name for the push notification
- *
- * @param aDisplayName Display name of push
- * @param aCompletionBlock The callback block of completion
- *
- */
- - (void)updatePushNotifiationDisplayName:(NSString *)aDisplayName
- completion:(void (^)(NSString *aDisplayName, EMError *aError))aCompletionBlock;
- /*!
- * \~chinese
- * 从服务器获取推送属性
- *
- * 同步方法,会阻塞当前线程
- *
- * @param pError 错误信息
- *
- * @result 推送属性
- *
- * \~english
- * Get Apple Push Notification Service options from the server
- *
- * Synchronization method will block the current thread
- *
- * @param pError Error
- *
- * @result Apple Push Notification Service options
- */
- - (EMPushOptions *)getPushOptionsFromServerWithError:(EMError **)pError;
- /*!
- * \~chinese
- * 从服务器获取推送属性
- *
- * @param aCompletionBlock 完成的回调
- *
- * \~english
- * Get Apple Push Notification Service options from the server
- *
- * @param aCompletionBlock The callback of completion block
- */
- - (void)getPushNotificationOptionsFromServerWithCompletion:(void (^)(EMPushOptions *aOptions, EMError *aError))aCompletionBlock;
- /*!
- * \~chinese
- * 更新推送设置到服务器
- *
- * 同步方法,会阻塞当前线程
- *
- * @result 错误信息
- *
- * \~english
- * Update Apple Push Notification Service options to the server
- *
- * Synchronization method will block the current thread
- *
- * @result Error
- */
- - (EMError *)updatePushOptionsToServer;
- /*!
- * \~chinese
- * 更新推送设置到服务器
- *
- * @param aCompletionBlock 完成的回调
- *
- * \~english
- * Update Apple Push Notification Service options to the server
- *
- * @param aCompletionBlock The callback block of completion
- */
- - (void)updatePushNotificationOptionsToServerWithCompletion:(void (^)(EMError *aError))aCompletionBlock;
- #pragma mark - Log
- /*!
- * \~chinese
- * 上传日志到服务器
- *
- * 同步方法,会阻塞当前线程
- *
- * @result 错误信息
- *
- * \~english
- * Upload debugging log to server
- *
- * Synchronization method will block the current thread
- *
- * @result Error
- */
- - (EMError *)uploadLogToServer;
- /*!
- * \~chinese
- * 上传日志到服务器
- *
- * @param aCompletionBlock 完成的回调
- *
- * \~english
- * Upload debugging log to server
- *
- * @param aCompletionBlock The callback of completion block
- */
- - (void)uploadDebugLogToServerWithCompletion:(void (^)(EMError *aError))aCompletionBlock;
- /*!
- * \~chinese
- * 将日志文件压缩成.gz文件,返回gz文件路径。强烈建议方法完成之后删除该压缩文件
- *
- * 同步方法,会阻塞当前线程
- *
- * @param pError 错误信息
- *
- * @result 文件路径
- *
- * \~english
- * 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
- *
- * @param pError Error
- *
- * @result File path
- */
- - (NSString *)getLogFilesPath:(EMError **)pError;
- /*!
- * \~chinese
- * 将日志文件压缩成.gz文件,返回gz文件路径。强烈建议方法完成之后删除该压缩文件
- *
- * @param aCompletionBlock 完成的回调
- *
- * \~english
- * 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
- *
- * @param aCompletionBlock The callback of completion block
- */
- - (void)getLogFilesPathWithCompletion:(void (^)(NSString *aPath, EMError *aError))aCompletionBlock;
- #pragma mark - Multi Devices
- /*!
- * \~chinese
- * 从服务器获取所有已经登录的设备信息
- *
- * 同步方法,会阻塞当前线程
- *
- * @param aUsername 用户名
- * @param aPassword 密码
- * @param pError 错误信息
- *
- * @result 所有已经登录的设备信息<EMDeviceConfig>
- *
- * \~english
- * Get all the device information <EMDeviceConfig> that logged in to the server
- *
- * Synchronization method will block the current thread
- *
- * @param aUsername Username
- * @param aPassword Password
- * @param pError Error
- *
- * @result Information of logged in device <EMDeviceConfig>
- */
- - (NSArray *)getLoggedInDevicesFromServerWithUsername:(NSString *)aUsername
- password:(NSString *)aPassword
- error:(EMError **)pError;
- /*!
- * \~chinese
- * 从服务器获取所有已经登录的设备信息
- *
- * @param aUsername 用户名
- * @param aPassword 密码
- * @param aCompletionBlock 完成的回调
- *
- * \~english
- * Get all the device information <EMDeviceConfig> that logged in to the server
- *
- * @param aUsername Username
- * @param aPassword Password
- * @param aCompletionBlock The callback block of completion
- *
- * @result aList Information of logged in device <EMDeviceConfig>
- */
- - (void)getLoggedInDevicesFromServerWithUsername:(NSString *)aUsername
- password:(NSString *)aPassword
- completion:(void (^)(NSArray *aList, EMError *aError))aCompletionBlock;
- /*!
- * \~chinese
- * 强制指定的设备退出
- *
- * 同步方法,会阻塞当前线程
- *
- * @param aUsername 用户名
- * @param aPassword 密码
- * @param aDevice 设备信息
- *
- * @result 错误信息
- *
- * \~english
- * Force logout the specified device
- *
- * device information can be obtained from getLoggedInDevicesFromServerWithUsername:password:error:
- *
- * Synchronization method will block the current thread
- *
- * @param aUsername Username
- * @param aPassword Password
- * @param aResource device resource
- *
- * @result Error
- */
- - (EMError *)kickDeviceWithUsername:(NSString *)aUsername
- password:(NSString *)aPassword
- resource:(NSString *)aResource;
- /*!
- * \~chinese
- * 强制指定的设备退出
- *
- * @param aUsername 用户名
- * @param aPassword 密码
- * @param aDevice 设备信息
- * @param aCompletionBlock 完成的回调
- *
- * \~english
- * Force logout the specified device
- *
- * device information can be obtained from getLoggedInDevicesFromServerWithUsername:password:error:
- *
- * @param aUsername Username
- * @param aPassword Password
- * @param aResource device resource
- * @param aCompletionBlock The callback block of completion
- */
- - (void)kickDeviceWithUsername:(NSString *)aUsername
- password:(NSString *)aPassword
- resource:(NSString *)aResource
- completion:(void (^)(EMError *aError))aCompletionBlock;
- /*!
- * \~chinese
- * 强制所有的登录设备退出
- *
- * 同步方法,会阻塞当前线程
- *
- * @param aUsername 用户名
- * @param aPassword 密码
- *
- * @result 错误信息
- *
- * \~english
- * Force logout all logged in device for the specified user
- *
- * Synchronization method will block the current thread
- *
- * @param aUsername Username
- * @param aPassword Password
- *
- * @result Error
- */
- - (EMError *)kickAllDevicesWithUsername:(NSString *)aUsername
- password:(NSString *)aPassword;
- /*!
- * \~chinese
- * 强制所有的登录设备退出
- *
- * @param aUsername 用户名
- * @param aPassword 密码
- * @param aCompletionBlock 完成的回调
- *
- * \~english
- * Force all logged in device to logout.
- *
- * @param aUsername Username
- * @param aPassword Password
- * @param aCompletionBlock The callback block of completion
- */
- - (void)kickAllDevicesWithUsername:(NSString *)aUsername
- password:(NSString *)aPassword
- completion:(void (^)(EMError *aError))aCompletionBlock;
- #pragma mark - iOS
- /*!
- * \~chinese
- * iOS专用,数据迁移到SDK3.0
- *
- * 同步方法,会阻塞当前线程
- *
- * 升级到SDK3.0版本需要调用该方法,开发者需要等该方法执行完后再进行数据库相关操作
- *
- * @result 是否迁移成功
- *
- * \~english
- * Migrate the IM database to the latest SDK version
- *
- * Synchronization method will block the current thread
- *
- * @result Return YES for success
- */
- - (BOOL)migrateDatabaseToLatestSDK;
- /*!
- * \~chinese
- * iOS专用,程序进入后台时,需要调用此方法断开连接
- *
- * @param aApplication UIApplication
- *
- * \~english
- * Disconnect from server when app enters background
- *
- * @param aApplication UIApplication
- */
- - (void)applicationDidEnterBackground:(id)aApplication;
- /*!
- * \~chinese
- * iOS专用,程序进入前台时,需要调用此方法进行重连
- *
- * @param aApplication UIApplication
- *
- * \~english
- * Reconnect to server when app enters foreground
- *
- * @param aApplication UIApplication
- */
- - (void)applicationWillEnterForeground:(id)aApplication;
- /*!
- * \~chinese
- * iOS专用,程序在前台收到APNs时,需要调用此方法
- *
- * @param application UIApplication
- * @param userInfo 推送内容
- *
- * \~english
- * Invoked when receiving APNs in foreground
- *
- * @param application UIApplication
- * @param userInfo Push content
- */
- - (void)application:(id)application didReceiveRemoteNotification:(NSDictionary *)userInfo;
- #pragma mark - Service Check
- /*!
- * \~chinese
- * 服务诊断接口,根据EMServerCheckType枚举的顺序依次诊断当前服务,并回调给开发者
- * 如果已经登录,默认使用登录账号
- *
- * @param aUsername 用户名
- * @param aPassword 密码
- * @param aCompletionBlock 完成的回调
- *
- * \~english
- * Make a diagnose for service, Diagnosis of current services according to the order of EMServerCheckType enumeration, and callback for the developer
- * If you have logged in, use the default login account
- *
- * @param aUsername username
- * @param aPassword password
- * @param aCompletionBlock The callback block of completion
- */
- - (void)serviceCheckWithUsername:(NSString *)aUsername
- password:(NSString *)aPassword
- completion:(void (^)(EMServerCheckType aType, EMError *aError))aCompletionBlock;
- #pragma mark - EM_DEPRECATED_IOS 3.2.3
- /*!
- * \~chinese
- * 添加回调代理
- *
- * @param aDelegate 要添加的代理
- *
- * \~english
- * Add delegate
- *
- * @param aDelegate Delegate
- */
- - (void)addDelegate:(id<EMClientDelegate>)aDelegate EM_DEPRECATED_IOS(3_1_0, 3_2_2, "Use -[IEMCallManager addDelegate:delegateQueue:]");
- #pragma mark - EM_DEPRECATED_IOS < 3.2.3
- /*!
- * \~chinese
- * 注册用户
- *
- * 不推荐使用,建议后台通过REST注册
- *
- * @param aUsername 用户名
- * @param aPassword 密码
- * @param aSuccessBlock 成功的回调
- * @param aFailureBlock 失败的回调
- *
- * \~english
- * Register a new user
- *
- * To enhance the reliability, registering new IM user through REST API from backend is highly recommended
- *
- * @param aUsername Username
- * @param aPassword Password
- * @param aSuccessBlock The callback block of success
- * @param aFailureBlock The callback block of failure
- *
- */
- - (void)asyncRegisterWithUsername:(NSString *)aUsername
- password:(NSString *)aPassword
- success:(void (^)())aSuccessBlock
- failure:(void (^)(EMError *aError))aFailureBlock __deprecated_msg("Use -registerWithUsername:password:completion:");
- /*!
- * \~chinese
- * 登录
- *
- * @param aUsername 用户名
- * @param aPassword 密码
- * @param aSuccessBlock 成功的回调
- * @param aFailureBlock 失败的回调
- *
- * \~english
- * Login
- *
- * @param aUsername Username
- * @param aPassword Password
- * @param aSuccessBlock The callback block of success
- * @param aFailureBlock The callback block of failure
- *
- */
- - (void)asyncLoginWithUsername:(NSString *)aUsername
- password:(NSString *)aPassword
- success:(void (^)())aSuccessBlock
- failure:(void (^)(EMError *aError))aFailureBlock __deprecated_msg("Use -loginWithUsername:password:completion");
- /*!
- * \~chinese
- * 退出
- *
- * @param aIsUnbindDeviceToken 是否解除device token的绑定,解除绑定后设备不会再收到消息推送
- * 如果传入YES, 解除绑定失败,将返回error
- *
- * @result 错误信息
- *
- * \~english
- * Logout
- *
- * @param aIsUnbindDeviceToken Unbind device token to disable the Apple Push Notification Service
- *
- * @result Error
- */
- - (void)asyncLogout:(BOOL)aIsUnbindDeviceToken
- success:(void (^)())aSuccessBlock
- failure:(void (^)(EMError *aError))aFailureBlock __deprecated_msg("Use -logout:completion:");
- /*!
- * \~chinese
- * 绑定device token
- *
- * @param aDeviceToken 要绑定的token
- * @param aSuccessBlock 成功的回调
- * @param aFailureBlock 失败的回调
- *
- * \~english
- * Bind device token
- *
- * @param aDeviceToken Device token to bind
- * @param aSuccessBlock The callback block of success
- * @param aFailureBlock The callback block of failure
- */
- - (void)asyncBindDeviceToken:(NSData *)aDeviceToken
- success:(void (^)())aSuccessBlock
- failure:(void (^)(EMError *aError))aFailureBlock __deprecated_msg("Use -registerForRemoteNotificationsWithDeviceToken:completion:");
- /*!
- * \~chinese
- * 设置推送消息显示的昵称
- *
- * @param aNickname 要设置的昵称
- * @param aSuccessBlock 成功的回调
- * @param aFailureBlock 失败的回调
- *
- * \~english
- * Set display name for push notification
- *
- * @param aNickname Push Notification display name
- * @param aSuccessBlock The callback block of success
- * @param aFailureBlock The callback block of failure
- *
- */
- - (void)asyncSetApnsNickname:(NSString *)aNickname
- success:(void (^)())aSuccessBlock
- failure:(void (^)(EMError *aError))aFailureBlock __deprecated_msg("Use -updatePushNotifiationDisplayName:copletion");
- /*!
- * \~chinese
- * 从服务器获取推送属性
- *
- * @param aSuccessBlock 成功的回调
- * @param aFailureBlock 失败的回调
- *
- * \~english
- * Get apns options from the server
- *
- * @param aSuccessBlock The callback block of success
- * @param aFailureBlock The callback block of failure
- */
- - (void)asyncGetPushOptionsFromServer:(void (^)(EMPushOptions *aOptions))aSuccessBlock
- failure:(void (^)(EMError *aError))aFailureBlock __deprecated_msg("Use -getPushOptionsFromServerWithCompletion:");
- /*!
- * \~chinese
- * 更新推送设置到服务器
- *
- * @param aSuccessBlock 成功的回调
- * @param aFailureBlock 失败的回调
- *
- * \~english
- * Update APNS options to the server
- *
- * @param aSuccessBlock The callback block of success
- * @param aFailureBlock The callback block of failure
- *
- */
- - (void)asyncUpdatePushOptionsToServer:(void (^)())aSuccessBlock
- failure:(void (^)(EMError *aError))aFailureBlock __deprecated_msg("Use -updatePushNotificationOptionsToServerWithCompletion:");
- /*!
- * \~chinese
- * 上传日志到服务器
- *
- * @param aSuccessBlock 成功的回调
- * @param aFailureBlock 失败的回调
- *
- * \~english
- * Upload log to server
- *
- * @param aSuccessBlock The callback block of success
- * @param aFailureBlock The callback block of failure
- */
- - (void)asyncUploadLogToServer:(void (^)())aSuccessBlock
- failure:(void (^)(EMError *aError))aFailureBlock __deprecated_msg("Use -uploadDebugLogToServerWithCompletion:");
- /*!
- * \~chinese
- * iOS专用,数据迁移到SDK3.0
- *
- * 同步方法,会阻塞当前线程
- *
- * 升级到SDK3.0版本需要调用该方法,开发者需要等该方法执行完后再进行数据库相关操作
- *
- * @result 是否迁移成功
- *
- * \~english
- * 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
- *
- * @result Whether migration successful
- */
- - (BOOL)dataMigrationTo3 __deprecated_msg("Use -migrateDatabaseToLatestSDK");
- /*!
- * \~chinese
- * 强制指定的设备退出
- *
- * 同步方法,会阻塞当前线程
- *
- * @param aDevice 设备信息
- * @param aUsername 用户名
- * @param aPassword 密码
- *
- * @result 错误信息
- *
- * \~english
- * Force logout the specified device
- *
- * device information can be obtained from getLoggedInDevicesFromServerWithUsername:password:error:
- *
- * Synchronization method will block the current thread
- *
- * @param aDevice device information <EMDeviceConfig>
- * @param aUsername Username
- * @param aPassword Password
- *
- * @result Error
- */
- - (EMError *)kickDevice:(EMDeviceConfig *)aDevice
- username:(NSString *)aUsername
- password:(NSString *)aPassword __deprecated_msg("Use - kickDeviceWithUsername:password:resource:");
- /*!
- * \~chinese
- * 强制指定的设备退出
- *
- * @param aDevice 设备信息
- * @param aUsername 用户名
- * @param aPassword 密码
- * @param aCompletionBlock 完成的回调
- *
- * \~english
- * Force logout the specified device
- *
- * device information can be obtained from getLoggedInDevicesFromServerWithUsername:password:error:
- *
- * @param aDevice device information <EMDeviceConfig>
- * @param aUsername Username
- * @param aPassword Password
- * @param aCompletionBlock The callback block of completion
- */
- - (void)kickDevice:(EMDeviceConfig *)aDevice
- username:(NSString *)aUsername
- password:(NSString *)aPassword
- completion:(void (^)(EMError *aError))aCompletionBlock __deprecated_msg("Use - kickDeviceWithUsername:password:resource:completion:");
- @end
|