WDGIM
WDGIM 是 Wilddog IM SDK 各个功能模块的入口。
delegate
Section titled “delegate”定义
@property (nonatomic, copy) id <WDGIMDelegate> delegate说明
WDGIM 的代理。
isConnecting
Section titled “isConnecting”定义
@property (nonatomic, readonly) BOOL isConnecting说明
正在连接 Wilddog IM 服务器。
isConnected
Section titled “isConnected”定义
@property (nonatomic, readonly) BOOL isConnected说明
已连接 Wilddog IM 服务器。
currentUser
Section titled “currentUser”定义
@property (nonatomic, strong) WDGIMUser *currentUser说明
当前登录用户。
定义
+ (instancetype)im说明
获取 WDGIM 单例。
返回值
WDGIM 单例对象
- connectWithCompletion:
Section titled “- connectWithCompletion:”定义
- (void)connectWithCompletion:(nullable void (^) (BOOL success, NSError *_Nullable error))completion说明
连接 Wilddog IM 服务器。
参数
| 参数名 | 描述 |
|---|---|
| completion | 连接结果回调 |
- disconnect
Section titled “- disconnect”定义
- (void)disconnect说明
断开 Wilddog IM 服务器。
- signInWithCustomToken:completion:
Section titled “- signInWithCustomToken:completion:”定义
- (void)signInWithCustomToken:(NSString *)token completion:(void (^) (WDGIMUser* _Nullable currentUser, NSError * _Nullable error))completion说明
用户服务器生成的 token 登录 Wilddog IM 服务器。
参数
| 参数名 | 描述 |
|---|---|
| token | Wilddog 指定 token |
| completion | 结果回调 |
- signOut:
Section titled “- signOut:”定义
- (BOOL)signOut:(NSError *_Nullable *_Nullable)error说明
登出 Wilddog IM 服务器。
参数
| 参数名 | 描述 |
|---|---|
| error | 错误信息 |
- updateRemoteNotificationDeviceToken:error:
Section titled “- updateRemoteNotificationDeviceToken:error:”定义
- (BOOL)updateRemoteNotificationDeviceToken:(nullable NSData *)deviceToken error:(NSError * _Nullable __autoreleasing *)error说明
远程推送,给 Wilddog IM 服务器上传 deviceToken。
参数
| 参数名 | 描述 |
|---|---|
| deviceToken | deviceToken |
| error | 错误信息 |
返回值
上传状态,YES 为成功。
- newConversationWithMembers:completion:
Section titled “- newConversationWithMembers:completion:”定义
- (void)newConversationWithMembers:(NSArray<NSString *> *)members completion:(void (^) (WDGIMConversation * _Nullable conversation, NSError * _Nullable * _Nullable error))completion说明
创建一个聊天会话。members 的数量两个人为单聊(包括登录用户),三个人及以上都为群聊。。
参数
| 参数名 | 描述 |
|---|---|
| members | 聊天成员(默认包含已登录用户 ID) |
| completion | 结果回调 |
- getConversations
Section titled “- getConversations”定义
- (nullable NSArray *)getConversations说明
获取所有会话。
返回值
会话数组
- getConversation:
Section titled “- getConversation:”定义
- (nullable WDGIMConversation *)getConversation:(NSString *)conversationID说明
获取指定会话。
参数
| 参数名 | 描述 |
|---|---|
| conversationID | 会话 ID |
返回值
会话对象