shmily

sdk upgrade

Too many changes to show.

To preserve performance only 22 of 22+ files are displayed.

@@ -9,7 +9,6 @@ @@ -9,7 +9,6 @@
9 #ifndef IMGroupExt_h 9 #ifndef IMGroupExt_h
10 #define IMGroupExt_h 10 #define IMGroupExt_h
11 11
12 -#import "ImSDK.h"  
13 #import "TIMComm+Group.h" 12 #import "TIMComm+Group.h"
14 #import "TIMGroupManager+Ext.h" 13 #import "TIMGroupManager+Ext.h"
15 14
@@ -9,7 +9,6 @@ @@ -9,7 +9,6 @@
9 #ifndef ImSDK_h 9 #ifndef ImSDK_h
10 #define ImSDK_h 10 #define ImSDK_h
11 11
12 -#import "ImSDK.h"  
13 #import "TIMConversation+MsgExt.h" 12 #import "TIMConversation+MsgExt.h"
14 #import "TIMMessage+MsgExt.h" 13 #import "TIMMessage+MsgExt.h"
15 #import "TIMComm+MsgExt.h" 14 #import "TIMComm+MsgExt.h"
@@ -15,8 +15,10 @@ @@ -15,8 +15,10 @@
15 #import "TIMConversation.h" 15 #import "TIMConversation.h"
16 #import "TIMGroupManager.h" 16 #import "TIMGroupManager.h"
17 #import "TIMCallback.h" 17 #import "TIMCallback.h"
18 -//#import "TIMFriendshipManager.h"  
19 -  
20 -//#import "IMSdkInt.h" 18 +#import "TIMFriendshipManager.h"
  19 +#import "IMSdkComm.h"
  20 +#import "TIMErrorCode.h"
  21 +#import "IMGroupExt.h"
  22 +#import "IMMessageExt.h"
21 23
22 #endif 24 #endif
@@ -14,6 +14,8 @@ @@ -14,6 +14,8 @@
14 @class TIMMessage; 14 @class TIMMessage;
15 @class TIMGroupTipsElem; 15 @class TIMGroupTipsElem;
16 @class TIMGroupInfo; 16 @class TIMGroupInfo;
  17 +@class TIMSNSChangeInfo;
  18 +@class TIMFriendPendencyInfo;
17 19
18 /** 20 /**
19 * 连接通知回调 21 * 连接通知回调
@@ -167,90 +169,40 @@ @@ -167,90 +169,40 @@
167 - (void)onGroupTipsEvent:(TIMGroupTipsElem*)elem; 169 - (void)onGroupTipsEvent:(TIMGroupTipsElem*)elem;
168 @end 170 @end
169 171
170 -///**  
171 -// * 好友代理事件回调  
172 -// */  
173 -//@protocol TIMFriendshipListener <NSObject>  
174 -//@optional  
175 -//  
176 -///**  
177 -// * 添加好友通知  
178 -// *  
179 -// * @param users 好友列表(TIMUserProfile*)  
180 -// */  
181 -//- (void)onAddFriends:(NSArray*)users;  
182 -//  
183 -///**  
184 -// * 删除好友通知  
185 -// *  
186 -// * @param identifiers 用户id列表(NSString*)  
187 -// */  
188 -//- (void)onDelFriends:(NSArray*)identifiers;  
189 -//  
190 -///**  
191 -// * 好友资料更新通知  
192 -// *  
193 -// * @param profiles 资料列表(TIMUserProfile*)  
194 -// */  
195 -//- (void)onFriendProfileUpdate:(NSArray*)profiles;  
196 -//  
197 -///**  
198 -// * 好友申请通知  
199 -// *  
200 -// * @param reqs 好友申请者id列表(TIMSNSChangeInfo*)  
201 -// */  
202 -//- (void)onAddFriendReqs:(NSArray*)reqs;  
203 -//  
204 -//@end 172 +/**
  173 + * 好友代理事件回调
  174 + */
  175 +@protocol TIMFriendshipListener <NSObject>
  176 +@optional
205 177
206 -//@protocol TIMGroupListener <NSObject>  
207 -//@optional  
208 -//  
209 -///**  
210 -// * 有新用户加入群时的通知回调  
211 -// *  
212 -// * @param groupId 群ID  
213 -// * @param membersInfo 加群用户的群资料(TIMGroupMemberInfo*)列表  
214 -// */  
215 -//- (void)onMemberJoin:(NSString*)groupId membersInfo:(NSArray*)membersInfo;  
216 -//  
217 -///**  
218 -// * 有群成员退群时的通知回调  
219 -// *  
220 -// * @param groupId 群ID  
221 -// * @param members 退群成员的identifier(NSString*)列表  
222 -// */  
223 -//- (void)onMemberQuit:(NSString*)groupId members:(NSArray*)members;  
224 -//  
225 -///**  
226 -// * 群成员信息更新的通知回调  
227 -// *  
228 -// * @param groupId 群ID  
229 -// * @param membersInfo 更新后的群成员资料(TIMGroupMemberInfo*)列表  
230 -// */  
231 -//- (void)onMemberUpdate:(NSString*)groupId membersInfo:(NSArray*)membersInfo;  
232 -//  
233 -///**  
234 -// * 加入群的通知回调  
235 -// *  
236 -// * @param groupInfo 加入群的群组资料  
237 -// */  
238 -//- (void)onGroupAdd:(TIMGroupInfo*)groupInfo;  
239 -//  
240 -///**  
241 -// * 本地群组资料被删除的通知回调,包括主动退群,被踢,群被解散,群被回收  
242 -// *  
243 -// * @param groupId 对应的群ID  
244 -// */  
245 -//- (void)onGroupDelete:(NSString*)groupId;  
246 -//  
247 -///**  
248 -// * 群资料更新的通知回调  
249 -// *  
250 -// * @param groupInfo 更新后的群资料信息  
251 -// */  
252 -//- (void)onGroupUpdate:(TIMGroupInfo*)groupInfo;  
253 -//  
254 -//@end 178 +/**
  179 + * 添加好友通知
  180 + *
  181 + * @param users 好友列表(NSString*)
  182 + */
  183 +- (void)onAddFriends:(NSArray*)users;
  184 +
  185 +/**
  186 + * 删除好友通知
  187 + *
  188 + * @param identifiers 用户id列表(NSString*)
  189 + */
  190 +- (void)onDelFriends:(NSArray*)identifiers;
  191 +
  192 +/**
  193 + * 好友资料更新通知
  194 + *
  195 + * @param profiles 资料列表(TIMSNSChangeInfo *)
  196 + */
  197 +- (void)onFriendProfileUpdate:(NSArray<TIMSNSChangeInfo *> *)profiles;
  198 +
  199 +/**
  200 + * 好友申请通知
  201 + *
  202 + * @param reqs 好友申请者id列表(TIMFriendPendencyInfo *)
  203 + */
  204 +- (void)onAddFriendReqs:(NSArray<TIMFriendPendencyInfo *> *)reqs;
  205 +
  206 +@end
255 207
256 #endif 208 #endif
@@ -9,9 +9,10 @@ @@ -9,9 +9,10 @@
9 #ifndef TIMComm_Group_h 9 #ifndef TIMComm_Group_h
10 #define TIMComm_Group_h 10 #define TIMComm_Group_h
11 11
12 -#import "ImSDK.h" 12 +#import "TIMComm.h"
13 13
14 @class TIMGroupPendencyMeta; 14 @class TIMGroupPendencyMeta;
  15 +@class TIMCreateGroupMemberInfo;
15 16
16 #pragma mark - 枚举类型 17 #pragma mark - 枚举类型
17 18
@@ -228,9 +229,9 @@ typedef void (^TIMGroupMemberSucc)(NSArray * members); @@ -228,9 +229,9 @@ typedef void (^TIMGroupMemberSucc)(NSArray * members);
228 /** 229 /**
229 * 群列表回调 230 * 群列表回调
230 * 231 *
231 - * @param arr 群列表 232 + * @param arr 群列表,成员类型 TIMGroupInfo
232 */ 233 */
233 -typedef void (^TIMGroupListSucc)(NSArray * arr); 234 +typedef void (^TIMGroupListSucc)(NSArray<TIMGroupInfo *> * arr);
234 235
235 /** 236 /**
236 * 本人群组内成员信息回调 237 * 本人群组内成员信息回调
@@ -329,7 +330,7 @@ typedef void (^TIMGetGroupPendencyListSucc)(TIMGroupPendencyMeta * meta, NSArray @@ -329,7 +330,7 @@ typedef void (^TIMGetGroupPendencyListSucc)(TIMGroupPendencyMeta * meta, NSArray
329 /** 330 /**
330 * 创建成员(TIMCreateGroupMemberInfo*)列表 331 * 创建成员(TIMCreateGroupMemberInfo*)列表
331 */ 332 */
332 -@property(nonatomic,strong) NSArray* membersInfo; 333 +@property(nonatomic,strong) NSArray <TIMCreateGroupMemberInfo *>* membersInfo;
333 334
334 @end 335 @end
335 336
@@ -10,7 +10,7 @@ @@ -10,7 +10,7 @@
10 #define TIMComm_MsgExt_h 10 #define TIMComm_MsgExt_h
11 11
12 #import <Foundation/Foundation.h> 12 #import <Foundation/Foundation.h>
13 -#import "ImSDK.h" 13 +#import "TIMComm.h"
14 14
15 @class TIMSendToUsersDetailInfo; 15 @class TIMSendToUsersDetailInfo;
16 16
@@ -21,16 +21,19 @@ @@ -21,16 +21,19 @@
21 @protocol TIMMessageRevokeListener; 21 @protocol TIMMessageRevokeListener;
22 @protocol TIMUploadProgressListener; 22 @protocol TIMUploadProgressListener;
23 @protocol TIMGroupEventListener; 23 @protocol TIMGroupEventListener;
24 -//@protocol TIMFriendshipListener; 24 +@protocol TIMFriendshipListener;
25 //@protocol TIMGroupListener; 25 //@protocol TIMGroupListener;
26 @class TIMMessage; 26 @class TIMMessage;
27 @class TIMImageElem; 27 @class TIMImageElem;
28 @class TIMConversation; 28 @class TIMConversation;
29 @class TIMAPNSConfig; 29 @class TIMAPNSConfig;
30 @class TIMUserProfile; 30 @class TIMUserProfile;
  31 +@class TIMFriend;
31 @class TIMGroupInfoOption; 32 @class TIMGroupInfoOption;
32 @class TIMGroupMemberInfoOption; 33 @class TIMGroupMemberInfoOption;
33 @class TIMFriendProfileOption; 34 @class TIMFriendProfileOption;
  35 +@class TIMFriendResult;
  36 +@class TIMCheckFriendResult;
34 37
35 #pragma mark - 枚举类型 38 #pragma mark - 枚举类型
36 39
@@ -53,10 +56,25 @@ typedef NS_ENUM(NSInteger, TIMNetworkStatus) { @@ -53,10 +56,25 @@ typedef NS_ENUM(NSInteger, TIMNetworkStatus) {
53 * 日志级别 56 * 日志级别
54 */ 57 */
55 typedef NS_ENUM(NSInteger, TIMLogLevel) { 58 typedef NS_ENUM(NSInteger, TIMLogLevel) {
  59 + /**
  60 + * 不输出任何 sdk log
  61 + */
56 TIM_LOG_NONE = 0, 62 TIM_LOG_NONE = 0,
  63 + /**
  64 + * 输出 DEBUG,INFO,WARNING,ERROR 级别的 log
  65 + */
57 TIM_LOG_DEBUG = 3, 66 TIM_LOG_DEBUG = 3,
  67 + /**
  68 + * 输出 INFO,WARNING,ERROR 级别的 log
  69 + */
58 TIM_LOG_INFO = 4, 70 TIM_LOG_INFO = 4,
  71 + /**
  72 + * 输出 WARNING,ERROR 级别的 log
  73 + */
59 TIM_LOG_WARN = 5, 74 TIM_LOG_WARN = 5,
  75 + /**
  76 + * 输出 ERROR 级别的 log
  77 + */
60 TIM_LOG_ERROR = 6, 78 TIM_LOG_ERROR = 6,
61 }; 79 };
62 80
@@ -175,19 +193,19 @@ typedef NS_ENUM(NSInteger, TIM_IMAGE_TYPE){ @@ -175,19 +193,19 @@ typedef NS_ENUM(NSInteger, TIM_IMAGE_TYPE){
175 */ 193 */
176 typedef NS_ENUM(NSInteger, TIM_IMAGE_FORMAT){ 194 typedef NS_ENUM(NSInteger, TIM_IMAGE_FORMAT){
177 /** 195 /**
178 - * JPG格式 196 + * JPG 格式
179 */ 197 */
180 TIM_IMAGE_FORMAT_JPG = 0x1, 198 TIM_IMAGE_FORMAT_JPG = 0x1,
181 /** 199 /**
182 - * GIF格式 200 + * GIF 格式
183 */ 201 */
184 TIM_IMAGE_FORMAT_GIF = 0x2, 202 TIM_IMAGE_FORMAT_GIF = 0x2,
185 /** 203 /**
186 - * PNG格式 204 + * PNG 格式
187 */ 205 */
188 TIM_IMAGE_FORMAT_PNG = 0x3, 206 TIM_IMAGE_FORMAT_PNG = 0x3,
189 /** 207 /**
190 - * BMP格式 208 + * BMP 格式
191 */ 209 */
192 TIM_IMAGE_FORMAT_BMP = 0x4, 210 TIM_IMAGE_FORMAT_BMP = 0x4,
193 /** 211 /**
@@ -196,6 +214,9 @@ typedef NS_ENUM(NSInteger, TIM_IMAGE_FORMAT){ @@ -196,6 +214,9 @@ typedef NS_ENUM(NSInteger, TIM_IMAGE_FORMAT){
196 TIM_IMAGE_FORMAT_UNKNOWN = 0xff, 214 TIM_IMAGE_FORMAT_UNKNOWN = 0xff,
197 }; 215 };
198 216
  217 +/**
  218 + * 登录状态
  219 + */
199 typedef NS_ENUM(NSInteger, TIMLoginStatus) { 220 typedef NS_ENUM(NSInteger, TIMLoginStatus) {
200 /** 221 /**
201 * 已登陆 222 * 已登陆
@@ -213,6 +234,9 @@ typedef NS_ENUM(NSInteger, TIMLoginStatus) { @@ -213,6 +234,9 @@ typedef NS_ENUM(NSInteger, TIMLoginStatus) {
213 TIM_STATUS_LOGOUT = 3, 234 TIM_STATUS_LOGOUT = 3,
214 }; 235 };
215 236
  237 +/**
  238 + * 群组成员是否可见
  239 + */
216 typedef NS_ENUM(NSInteger, TIMGroupMemberVisibleType) { 240 typedef NS_ENUM(NSInteger, TIMGroupMemberVisibleType) {
217 /** 241 /**
218 * 未知 242 * 未知
@@ -228,6 +252,9 @@ typedef NS_ENUM(NSInteger, TIMGroupMemberVisibleType) { @@ -228,6 +252,9 @@ typedef NS_ENUM(NSInteger, TIMGroupMemberVisibleType) {
228 TIM_GROUP_MEMBER_VISIBLE_YES = 0x02, 252 TIM_GROUP_MEMBER_VISIBLE_YES = 0x02,
229 }; 253 };
230 254
  255 +/**
  256 + * 群组是否能被搜到
  257 + */
231 typedef NS_ENUM(NSInteger, TIMGroupSearchableType) { 258 typedef NS_ENUM(NSInteger, TIMGroupSearchableType) {
232 /** 259 /**
233 * 未知 260 * 未知
@@ -302,13 +329,13 @@ typedef NS_ENUM(NSInteger, TIMGroupReceiveMessageOpt) { @@ -302,13 +329,13 @@ typedef NS_ENUM(NSInteger, TIMGroupReceiveMessageOpt) {
302 */ 329 */
303 TIM_GROUP_NOT_RECEIVE_MESSAGE = 1, 330 TIM_GROUP_NOT_RECEIVE_MESSAGE = 1,
304 /** 331 /**
305 - * 接受消息,不进行iOS APNs 推送 332 + * 接受消息,不进行 iOS APNs 推送
306 */ 333 */
307 TIM_GROUP_RECEIVE_NOT_NOTIFY_MESSAGE = 2, 334 TIM_GROUP_RECEIVE_NOT_NOTIFY_MESSAGE = 2,
308 }; 335 };
309 336
310 /** 337 /**
311 - * 群Tips类型 338 + * 群 Tips 类型
312 */ 339 */
313 typedef NS_ENUM(NSInteger, TIM_GROUP_TIPS_TYPE){ 340 typedef NS_ENUM(NSInteger, TIM_GROUP_TIPS_TYPE){
314 /** 341 /**
@@ -342,7 +369,7 @@ typedef NS_ENUM(NSInteger, TIM_GROUP_TIPS_TYPE){ @@ -342,7 +369,7 @@ typedef NS_ENUM(NSInteger, TIM_GROUP_TIPS_TYPE){
342 }; 369 };
343 370
344 /** 371 /**
345 - * 群Tips类型 372 + * 群变更信息 Tips 类型
346 */ 373 */
347 typedef NS_ENUM(NSInteger, TIM_GROUP_INFO_CHANGE_TYPE){ 374 typedef NS_ENUM(NSInteger, TIM_GROUP_INFO_CHANGE_TYPE){
348 /** 375 /**
@@ -433,6 +460,9 @@ typedef NS_ENUM(NSInteger, TIM_GROUP_SYSTEM_TYPE){ @@ -433,6 +460,9 @@ typedef NS_ENUM(NSInteger, TIM_GROUP_SYSTEM_TYPE){
433 TIM_GROUP_SYSTEM_CUSTOM_INFO = 0xff, 460 TIM_GROUP_SYSTEM_CUSTOM_INFO = 0xff,
434 }; 461 };
435 462
  463 +/**
  464 + * 推送规则
  465 + */
436 typedef NS_ENUM(NSInteger, TIMOfflinePushFlag) { 466 typedef NS_ENUM(NSInteger, TIMOfflinePushFlag) {
437 /** 467 /**
438 * 按照默认规则进行推送 468 * 按照默认规则进行推送
@@ -444,6 +474,9 @@ typedef NS_ENUM(NSInteger, TIMOfflinePushFlag) { @@ -444,6 +474,9 @@ typedef NS_ENUM(NSInteger, TIMOfflinePushFlag) {
444 TIM_OFFLINE_PUSH_NO_PUSH = 1, 474 TIM_OFFLINE_PUSH_NO_PUSH = 1,
445 }; 475 };
446 476
  477 +/**
  478 + * 安卓离线推送模式
  479 + */
447 typedef NS_ENUM(NSInteger, TIMAndroidOfflinePushNotifyMode) { 480 typedef NS_ENUM(NSInteger, TIMAndroidOfflinePushNotifyMode) {
448 /** 481 /**
449 * 通知栏消息 482 * 通知栏消息
@@ -480,6 +513,9 @@ typedef NS_ENUM(NSInteger, TIMGroupMemberRole) { @@ -480,6 +513,9 @@ typedef NS_ENUM(NSInteger, TIMGroupMemberRole) {
480 TIM_GROUP_MEMBER_ROLE_SUPER = 400, 513 TIM_GROUP_MEMBER_ROLE_SUPER = 400,
481 }; 514 };
482 515
  516 +/**
  517 + * 好友验证方式
  518 + */
483 typedef NS_ENUM(NSInteger, TIMFriendAllowType) { 519 typedef NS_ENUM(NSInteger, TIMFriendAllowType) {
484 /** 520 /**
485 * 同意任何用户加好友 521 * 同意任何用户加好友
@@ -497,6 +533,9 @@ typedef NS_ENUM(NSInteger, TIMFriendAllowType) { @@ -497,6 +533,9 @@ typedef NS_ENUM(NSInteger, TIMFriendAllowType) {
497 TIM_FRIEND_DENY_ANY = 2, 533 TIM_FRIEND_DENY_ANY = 2,
498 }; 534 };
499 535
  536 +/**
  537 + * 性别
  538 + */
500 typedef NS_ENUM(NSInteger, TIMGender) { 539 typedef NS_ENUM(NSInteger, TIMGender) {
501 /** 540 /**
502 * 未知性别 541 * 未知性别
@@ -513,61 +552,8 @@ typedef NS_ENUM(NSInteger, TIMGender) { @@ -513,61 +552,8 @@ typedef NS_ENUM(NSInteger, TIMGender) {
513 552
514 }; 553 };
515 554
516 -/**  
517 - * 基本资料标志位  
518 - */  
519 -typedef NS_ENUM(NSInteger, TIMProfileFlag) {  
520 - /**  
521 - * 昵称  
522 - */  
523 - TIM_PROFILE_FLAG_NICK = 0x01,  
524 - /**  
525 - * 好友验证方式  
526 - */  
527 - TIM_PROFILE_FLAG_ALLOW_TYPE = (0x01 << 1),  
528 - /**  
529 - * 头像  
530 - */  
531 - TIM_PROFILE_FLAG_FACE_URL = (0x01 << 2),  
532 - /**  
533 - * 好友备注  
534 - */  
535 - TIM_PROFILE_FLAG_REMARK = (0x01 << 3),  
536 - /**  
537 - * 好友分组  
538 - */  
539 - TIM_PROFILE_FLAG_GROUP = (0x01 << 4),  
540 - /**  
541 - * 用户签名  
542 - */  
543 - TIM_PROFILE_FLAG_SELFSIGNATURE = (0x01 << 5),  
544 - /**  
545 - * 用户性别  
546 - */  
547 - TIM_PROFILE_FLAG_GENDER = (0x01 << 6),  
548 - /**  
549 - * 用户生日  
550 - */  
551 - TIM_PROFILE_FLAG_BIRTHDAY = (0x01 << 7),  
552 - /**  
553 - * 用户区域  
554 - */  
555 - TIM_PROFILE_FLAG_LOCATION = (0x01 << 8),  
556 - /**  
557 - * 用户语言  
558 - */  
559 - TIM_PROFILE_FLAG_LANGUAGE = (0x01 << 9),  
560 - /**  
561 - * 用户等级  
562 - */  
563 - TIM_PROFILE_FLAG_LEVEL = (0x01 << 10),  
564 - /**  
565 - * 用户角色  
566 - */  
567 - TIM_PROFILE_FLAG_ROLE = (0x01 << 11),  
568 -};  
569 555
570 -#pragma mark - block回调 556 +#pragma mark - block 回调
571 557
572 /** 558 /**
573 * 获取消息回调 559 * 获取消息回调
@@ -620,12 +606,12 @@ typedef void (^TIMLogFunc)(TIMLogLevel lvl, NSString * msg); @@ -620,12 +606,12 @@ typedef void (^TIMLogFunc)(TIMLogLevel lvl, NSString * msg);
620 /** 606 /**
621 * 上传图片成功回调 607 * 上传图片成功回调
622 * 608 *
623 - * @param elem 上传图片成功后elem 609 + * @param elem 上传图片成功后 elem
624 */ 610 */
625 typedef void (^TIMUploadImageSucc)(TIMImageElem * elem); 611 typedef void (^TIMUploadImageSucc)(TIMImageElem * elem);
626 612
627 /** 613 /**
628 - * APNs推送配置更新成功回调 614 + * APNs 推送配置更新成功回调
629 * 615 *
630 * @param config 配置 616 * @param config 配置
631 */ 617 */
@@ -634,7 +620,7 @@ typedef void (^TIMAPNSConfigSucc)(TIMAPNSConfig* config); @@ -634,7 +620,7 @@ typedef void (^TIMAPNSConfigSucc)(TIMAPNSConfig* config);
634 /** 620 /**
635 * 群创建成功 621 * 群创建成功
636 * 622 *
637 - * @param groupId 群组Id 623 + * @param groupId 群组 Id
638 */ 624 */
639 typedef void (^TIMCreateGroupSucc)(NSString * groupId); 625 typedef void (^TIMCreateGroupSucc)(NSString * groupId);
640 626
@@ -643,7 +629,7 @@ typedef void (^TIMCreateGroupSucc)(NSString * groupId); @@ -643,7 +629,7 @@ typedef void (^TIMCreateGroupSucc)(NSString * groupId);
643 * 629 *
644 * @param friends 好友列表 630 * @param friends 好友列表
645 */ 631 */
646 -typedef void (^TIMFriendSucc)(NSArray * friends); 632 +typedef void (^TIMFriendArraySucc)(NSArray<TIMFriend *> *friends);
647 633
648 /** 634 /**
649 * 获取资料回调 635 * 获取资料回调
@@ -652,566 +638,395 @@ typedef void (^TIMFriendSucc)(NSArray * friends); @@ -652,566 +638,395 @@ typedef void (^TIMFriendSucc)(NSArray * friends);
652 */ 638 */
653 typedef void (^TIMGetProfileSucc)(TIMUserProfile * profile); 639 typedef void (^TIMGetProfileSucc)(TIMUserProfile * profile);
654 640
  641 +/**
  642 + * 获取资料回调
  643 + *
  644 + * @param profiles 资料
  645 + */
  646 +typedef void (^TIMUserProfileArraySucc)(NSArray<TIMUserProfile *> *profiles);
  647 +
  648 +/**
  649 + * 好友操作回调
  650 + *
  651 + * @param result 资料
  652 + */
  653 +typedef void (^TIMFriendResultSucc)(TIMFriendResult *result);
  654 +
  655 +/**
  656 + * 好友操作回调
  657 + *
  658 + * @param results 资料
  659 + */
  660 +typedef void (^TIMFriendResultArraySucc)(NSArray<TIMFriendResult *> *results);
  661 +
  662 +/**
  663 + * 检查好友操作回调
  664 + *
  665 + * @param results 检查结果
  666 + */
  667 +typedef void (^TIMCheckFriendResultArraySucc)(NSArray<TIMCheckFriendResult *> *results);
  668 +
655 #pragma mark - 基本类型 669 #pragma mark - 基本类型
656 670
  671 +/// 实现 NSCoding 协议
657 @interface TIMCodingModel : NSObject <NSCoding> 672 @interface TIMCodingModel : NSObject <NSCoding>
658 673
  674 +///读取实例变量,并把这些数据写到 coder 中去,序列化数据
659 - (void)encodeWithCoder:(NSCoder *)encoder; 675 - (void)encodeWithCoder:(NSCoder *)encoder;
  676 +
  677 +///从 coder 中读取数据,保存到相应的变量中,即反序列化数据
660 - (id)initWithCoder:(NSCoder *)decoder; 678 - (id)initWithCoder:(NSCoder *)decoder;
661 679
662 @end 680 @end
663 681
  682 +/// 初始化 SDK 配置信息
664 @interface TIMSdkConfig : NSObject 683 @interface TIMSdkConfig : NSObject
665 684
666 -/**  
667 - * 用户标识接入SDK的应用ID,必填  
668 - */ 685 +///用户标识接入 SDK 的应用 ID,必填
669 @property(nonatomic,assign) int sdkAppId; 686 @property(nonatomic,assign) int sdkAppId;
670 687
671 -/**  
672 - * 用户的账号类型,必填  
673 - */  
674 -@property(nonatomic,strong) NSString * accountType;  
675 -  
676 -/**  
677 - * 禁用crash上报,默认上报  
678 - */  
679 -@property(nonatomic,assign) BOOL disableCrashReport; 688 +///用户的账号类型,新版本不需要再填写
  689 +//@property(nonatomic,strong) NSString * accountType;
680 690
681 -/**  
682 - * 禁止在控制台打印log  
683 - */ 691 +///禁止在控制台打印 log
684 @property(nonatomic,assign) BOOL disableLogPrint; 692 @property(nonatomic,assign) BOOL disableLogPrint;
685 693
686 -/**  
687 - * 本地写log文件的等级,默认DEBUG等级  
688 - */ 694 +///本地写 log 文件的等级,默认 DEBUG 等级
689 @property(nonatomic,assign) TIMLogLevel logLevel; 695 @property(nonatomic,assign) TIMLogLevel logLevel;
690 696
691 -/**  
692 - * log文件路径,不设置时为默认路径  
693 - */ 697 +///log 文件路径,不设置时为默认路径
694 @property(nonatomic,strong) NSString * logPath; 698 @property(nonatomic,strong) NSString * logPath;
695 699
696 -/**  
697 - * 回调给log函数的log等级,默认DEBUG等级  
698 - */ 700 +///回调给 log 函数的 log 等级,默认 DEBUG 等级
699 @property(nonatomic,assign) TIMLogLevel logFuncLevel; 701 @property(nonatomic,assign) TIMLogLevel logFuncLevel;
700 702
701 -/**  
702 - * log监听函数  
703 - */ 703 +///log 监听函数
704 @property(nonatomic,copy) TIMLogFunc logFunc; 704 @property(nonatomic,copy) TIMLogFunc logFunc;
705 705
706 -/**  
707 - * 消息数据库路径,不设置时为默认路径  
708 - */ 706 +///消息数据库路径,不设置时为默认路径
709 @property(nonatomic,strong) NSString * dbPath; 707 @property(nonatomic,strong) NSString * dbPath;
710 708
711 -/**  
712 - * 网络监听器  
713 - */ 709 +///网络监听器
714 @property(nonatomic,strong) id<TIMConnListener> connListener; 710 @property(nonatomic,strong) id<TIMConnListener> connListener;
715 711
716 @end 712 @end
717 713
718 - 714 +/// 设置用户配置信息
719 @interface TIMUserConfig : NSObject 715 @interface TIMUserConfig : NSObject
720 716
721 -/**  
722 - * 禁用本地存储(加载消息扩展包有效)  
723 - */  
724 -@property(nonatomic,assign) BOOL disableStorage;  
725 -  
726 -/**  
727 - * 禁止自动上报(加载消息扩展包有效)  
728 - */ 717 +///禁止消息已读自动上报,一旦禁用自动上报,需要开发者显式调用 setReadMessage ,详情请参考官网文档 [未读消息计数](https://cloud.tencent.com/document/product/269/9151)
729 @property(nonatomic,assign) BOOL disableAutoReport; 718 @property(nonatomic,assign) BOOL disableAutoReport;
730 719
731 -/**  
732 - * 开启C2C已读回执(加载消息扩展包有效)  
733 - */ 720 +///开启 C2C 已读回执,只针对 C2C 消息生效,用户开启已读回执功能后,对方调用 setReadMessage 时会同步已读信息到本客户端,您可以在 TIMMessageReceiptListener 监听消息已读回执
734 @property(nonatomic,assign) BOOL enableReadReceipt; 721 @property(nonatomic,assign) BOOL enableReadReceipt;
735 722
736 -/**  
737 - * 不开启最近联系人(加载消息扩展包有效)  
738 - */  
739 -@property(nonatomic,assign) BOOL disableRecnetContact;  
740 -  
741 -/**  
742 - * 不通过onNewMessage:抛出最近联系人的最后一条消息(加载消息扩展包有效)  
743 - */  
744 -@property(nonatomic,assign) BOOL disableRecentContactNotify;  
745 -  
746 -///**  
747 -// * 开启关系链数据本地缓存功能(加载好友扩展包有效)  
748 -// */  
749 -//@property(nonatomic,assign) BOOL enableFriendshipProxy;  
750 -  
751 -///**  
752 -// * 开启群组数据本地缓存功能(加载群组扩展包有效)  
753 -// */  
754 -//@property(nonatomic,assign) BOOL enableGroupAssistant;  
755 -  
756 -/**  
757 - * 设置默认拉取的群组资料  
758 - */ 723 +///设置默认拉取的群组资料
759 @property(nonatomic,strong) TIMGroupInfoOption * groupInfoOpt; 724 @property(nonatomic,strong) TIMGroupInfoOption * groupInfoOpt;
760 725
761 -/**  
762 - * 设置默认拉取的群成员资料  
763 - */ 726 +///设置默认拉取的群成员资料
764 @property(nonatomic,strong) TIMGroupMemberInfoOption * groupMemberInfoOpt; 727 @property(nonatomic,strong) TIMGroupMemberInfoOption * groupMemberInfoOpt;
765 728
766 -/**  
767 - * 设置默认拉取的好友资料  
768 - */ 729 +///关系链参数
769 @property(nonatomic,strong) TIMFriendProfileOption * friendProfileOpt; 730 @property(nonatomic,strong) TIMFriendProfileOption * friendProfileOpt;
770 731
771 -/**  
772 - * 用户登录状态监听器  
773 - */  
774 -@property(nonatomic,strong) id<TIMUserStatusListener> userStatusListener;  
775 -  
776 -/**  
777 - * 会话刷新监听器(未读计数、已读同步)(加载消息扩展包有效)  
778 - */  
779 -@property(nonatomic,strong) id<TIMRefreshListener> refreshListener; 732 +///用户登录状态监听器
  733 +@property(nonatomic,weak) id<TIMUserStatusListener> userStatusListener;
780 734
781 -/**  
782 - * 消息已读回执监听器(加载消息扩展包有效)  
783 - */  
784 -@property(nonatomic,strong) id<TIMMessageReceiptListener> messageReceiptListener; 735 +///会话刷新监听器(未读计数、已读同步)
  736 +@property(nonatomic,weak) id<TIMRefreshListener> refreshListener;
785 737
786 -/**  
787 - * 消息svr重写监听器(加载消息扩展包有效)  
788 - */  
789 -@property(nonatomic,strong) id<TIMMessageUpdateListener> messageUpdateListener; 738 +///消息已读回执监听器
  739 +@property(nonatomic,weak) id<TIMMessageReceiptListener> messageReceiptListener;
790 740
791 -/**  
792 - * 消息撤回监听器(加载消息扩展包有效)  
793 - */  
794 -@property(nonatomic,strong) id<TIMMessageRevokeListener> messageRevokeListener; 741 +///消息 svr 重写监听器
  742 +@property(nonatomic,weak) id<TIMMessageUpdateListener> messageUpdateListener;
795 743
796 -/**  
797 - * 文件上传进度监听器  
798 - */  
799 -@property(nonatomic,strong) id<TIMUploadProgressListener> uploadProgressListener; 744 +///消息撤回监听器
  745 +@property(nonatomic,weak) id<TIMMessageRevokeListener> messageRevokeListener;
800 746
801 -/**  
802 - * 群组事件通知监听器  
803 - */  
804 -@property(nonatomic,strong) id<TIMGroupEventListener> groupEventListener; 747 +///文件上传进度监听器
  748 +@property(nonatomic,weak) id<TIMUploadProgressListener> uploadProgressListener;
805 749
806 -///**  
807 -// * 关系链数据本地缓存监听器(加载好友扩展包、enableFriendshipProxy有效)  
808 -// */  
809 -//@property(nonatomic,strong) id<TIMFriendshipListener> friendshipListener; 750 +///群组事件通知监听器
  751 +@property(nonatomic,weak) id<TIMGroupEventListener> groupEventListener;
810 752
811 -///**  
812 -// * 群组据本地缓存监听器(加载群组扩展包、enableGroupAssistant有效)  
813 -// */  
814 -//@property(nonatomic,strong) id<TIMGroupListener> groupListener; 753 +///关系链数据本地缓存监听器
  754 +@property(nonatomic,weak) id<TIMFriendshipListener> friendshipListener;
815 755
816 @end 756 @end
817 757
818 -/**  
819 - * 登陆信息  
820 - */  
821 - 758 +/// 登陆参数
822 @interface TIMLoginParam : NSObject 759 @interface TIMLoginParam : NSObject
823 760
824 -/**  
825 - * 用户名  
826 - */ 761 +///用户名
827 @property(nonatomic,strong) NSString* identifier; 762 @property(nonatomic,strong) NSString* identifier;
828 763
829 -/**  
830 - * 鉴权Token  
831 - */ 764 +///鉴权 Token
832 @property(nonatomic,strong) NSString* userSig; 765 @property(nonatomic,strong) NSString* userSig;
833 766
834 -/**  
835 - * App用户使用OAuth授权体系分配的Appid  
836 - */ 767 +///App 用户使用 OAuth 授权体系分配的 Appid
837 @property(nonatomic,strong) NSString* appidAt3rd; 768 @property(nonatomic,strong) NSString* appidAt3rd;
838 769
839 770
840 @end 771 @end
841 772
842 -/**  
843 - * APNs 配置  
844 - */ 773 +/// APNs 配置
845 @interface TIMAPNSConfig : NSObject 774 @interface TIMAPNSConfig : NSObject
846 -/**  
847 - * 是否开启推送:0-不进行设置 1-开启推送 2-关闭推送  
848 - */ 775 +
  776 +///是否开启推送:0-不进行设置 1-开启推送 2-关闭推送
849 @property(nonatomic,assign) uint32_t openPush; 777 @property(nonatomic,assign) uint32_t openPush;
850 -/**  
851 - * C2C消息声音,不设置传入nil  
852 - */ 778 +
  779 +///C2C 消息声音,不设置传入 nil
853 @property(nonatomic,strong) NSString * c2cSound; 780 @property(nonatomic,strong) NSString * c2cSound;
854 781
855 -/**  
856 - * Group消息声音,不设置传入nil  
857 - */ 782 +///Group 消息声音,不设置传入 nil
858 @property(nonatomic,strong) NSString * groupSound; 783 @property(nonatomic,strong) NSString * groupSound;
859 784
860 -/**  
861 - * Video声音,不设置传入nil  
862 - */ 785 +///Video 音视频邀请声音,不设置传入 nil (暂不支持)
863 @property(nonatomic,strong) NSString * videoSound; 786 @property(nonatomic,strong) NSString * videoSound;
864 787
865 @end 788 @end
866 789
867 -/**  
868 - * SetToken 参数  
869 - */ 790 +/// SetToken 参数
870 @interface TIMTokenParam : NSObject 791 @interface TIMTokenParam : NSObject
871 -/**  
872 - * 获取的客户端Token信息  
873 - */ 792 +
  793 +///获取的客户端 Token 信息
874 @property(nonatomic,strong) NSData* token; 794 @property(nonatomic,strong) NSData* token;
875 -/**  
876 - * 业务ID,传递证书时分配  
877 - */ 795 +
  796 +///业务 ID,传递证书时分配
878 @property(nonatomic,assign) uint32_t busiId; 797 @property(nonatomic,assign) uint32_t busiId;
879 798
880 @end 799 @end
881 800
882 -  
883 -/**  
884 - * 切后台参数  
885 - */ 801 +/// 切后台参数
886 @interface TIMBackgroundParam : NSObject 802 @interface TIMBackgroundParam : NSObject
887 803
888 -/**  
889 - * C2C 未读计数  
890 - */ 804 +///C2C 未读计数
891 @property(nonatomic,assign) int c2cUnread; 805 @property(nonatomic,assign) int c2cUnread;
892 806
893 -/**  
894 - * 群 未读计数  
895 - */ 807 +///群未读计数
896 @property(nonatomic,assign) int groupUnread; 808 @property(nonatomic,assign) int groupUnread;
897 809
898 @end 810 @end
899 811
  812 +/// 消息定位
900 @interface TIMMessageLocator : NSObject 813 @interface TIMMessageLocator : NSObject
901 -/**  
902 - * 所属会话的id  
903 - */ 814 +
  815 +///所属会话的 id
904 @property(nonatomic,strong) NSString * sessId; 816 @property(nonatomic,strong) NSString * sessId;
905 -/**  
906 - * 所属会话的类型  
907 - */ 817 +
  818 +///所属会话的类型
908 @property(nonatomic,assign) TIMConversationType sessType; 819 @property(nonatomic,assign) TIMConversationType sessType;
909 -/**  
910 - * 消息序列号  
911 - */ 820 +
  821 +///消息序列号
912 @property(nonatomic,assign) uint64_t seq; 822 @property(nonatomic,assign) uint64_t seq;
913 -/**  
914 - * 消息随机码  
915 - */ 823 +
  824 +///消息随机码
916 @property(nonatomic,assign) uint64_t rand; 825 @property(nonatomic,assign) uint64_t rand;
917 -/**  
918 - * 消息时间戳  
919 - */ 826 +
  827 +///消息时间戳
920 @property(nonatomic,assign) time_t time; 828 @property(nonatomic,assign) time_t time;
921 -/**  
922 - * 是否本人消息  
923 - */ 829 +
  830 +///是否本人消息
924 @property(nonatomic,assign) BOOL isSelf; 831 @property(nonatomic,assign) BOOL isSelf;
925 832
926 -/**  
927 - * 是否来自撤销通知  
928 - */ 833 +///是否来自撤销通知
929 @property(nonatomic,assign) BOOL isFromRevokeNotify; 834 @property(nonatomic,assign) BOOL isFromRevokeNotify;
930 835
931 @end 836 @end
932 837
933 -/**  
934 - * 已读回执  
935 - */ 838 +/// 已读回执
936 @interface TIMMessageReceipt : NSObject 839 @interface TIMMessageReceipt : NSObject
937 -/**  
938 - * 已读回执对应的会话(目前只支持C2C会话)  
939 - */ 840 +
  841 +///已读回执对应的会话(目前只支持 C2C 会话)
940 @property(nonatomic,strong) TIMConversation * conversation; 842 @property(nonatomic,strong) TIMConversation * conversation;
941 -/**  
942 - * 收到已读回执时,这个时间戳之前的消息都已读  
943 - */ 843 +
  844 +///收到已读回执时,这个时间戳之前的消息都已读
944 @property(nonatomic,assign) time_t timestamp; 845 @property(nonatomic,assign) time_t timestamp;
945 @end 846 @end
946 847
  848 +/// Android 离线推送配置
947 @interface TIMAndroidOfflinePushConfig : NSObject 849 @interface TIMAndroidOfflinePushConfig : NSObject
948 -/**  
949 - * 离线推送时展示标签  
950 - */ 850 +
  851 +///离线推送时展示标签
951 @property(nonatomic,strong) NSString * title; 852 @property(nonatomic,strong) NSString * title;
952 -/**  
953 - * Android离线Push时声音字段信息  
954 - */ 853 +
  854 +///Android 离线 Push 时声音字段信息
955 @property(nonatomic,strong) NSString * sound; 855 @property(nonatomic,strong) NSString * sound;
956 -/**  
957 - * 离线推送时通知形式  
958 - */ 856 +
  857 +///离线推送时通知形式
959 @property(nonatomic,assign) TIMAndroidOfflinePushNotifyMode notifyMode; 858 @property(nonatomic,assign) TIMAndroidOfflinePushNotifyMode notifyMode;
960 859
961 @end 860 @end
962 861
  862 +/// iOS 离线推送配置
963 @interface TIMIOSOfflinePushConfig : NSObject 863 @interface TIMIOSOfflinePushConfig : NSObject
964 -/**  
965 - * 离线Push时声音字段信息  
966 - */ 864 +
  865 +///离线 Push 时声音字段信息
967 @property(nonatomic,strong) NSString * sound; 866 @property(nonatomic,strong) NSString * sound;
968 -/**  
969 - * 忽略badge计数  
970 - */ 867 +
  868 +///忽略 badge 计数
971 @property(nonatomic,assign) BOOL ignoreBadge; 869 @property(nonatomic,assign) BOOL ignoreBadge;
972 870
973 @end 871 @end
974 872
975 -/**  
976 - * 群组内的本人信息  
977 - */ 873 +/// 群组内的本人信息
978 @interface TIMGroupSelfInfo : NSObject 874 @interface TIMGroupSelfInfo : NSObject
979 875
980 -/**  
981 - * 加入群组时间  
982 - */ 876 +///加入群组时间
983 @property(nonatomic,assign) uint32_t joinTime; 877 @property(nonatomic,assign) uint32_t joinTime;
984 878
985 -/**  
986 - * 群组中的角色  
987 - */ 879 +///群组中的角色
988 @property(nonatomic,assign) TIMGroupMemberRole role; 880 @property(nonatomic,assign) TIMGroupMemberRole role;
989 881
990 -/**  
991 - * 群组消息接收选项  
992 - */ 882 +///群组消息接收选项
993 @property(nonatomic,assign) TIMGroupReceiveMessageOpt recvOpt; 883 @property(nonatomic,assign) TIMGroupReceiveMessageOpt recvOpt;
994 884
995 -/**  
996 - * 群组中的未读消息数  
997 - */ 885 +///群组中的未读消息数
998 @property(nonatomic,assign) uint32_t unReadMessageNum; 886 @property(nonatomic,assign) uint32_t unReadMessageNum;
999 887
1000 @end 888 @end
1001 889
1002 -/**  
1003 - * 群资料信息  
1004 - */ 890 +/// 群资料信息
1005 @interface TIMGroupInfo : TIMCodingModel 891 @interface TIMGroupInfo : TIMCodingModel
1006 892
1007 -/**  
1008 - * 群组Id  
1009 - */ 893 +///群组 Id
1010 @property(nonatomic,strong) NSString* group; 894 @property(nonatomic,strong) NSString* group;
1011 -/**  
1012 - * 群名  
1013 - */ 895 +
  896 +///群名
1014 @property(nonatomic,strong) NSString* groupName; 897 @property(nonatomic,strong) NSString* groupName;
1015 -/**  
1016 - * 群创建人/管理员  
1017 - */ 898 +
  899 +///群创建人/管理员
1018 @property(nonatomic,strong) NSString * owner; 900 @property(nonatomic,strong) NSString * owner;
1019 -/**  
1020 - * 群类型:Private,Public,ChatRoom  
1021 - */ 901 +
  902 +///群类型:Private,Public,ChatRoom
1022 @property(nonatomic,strong) NSString* groupType; 903 @property(nonatomic,strong) NSString* groupType;
1023 -/**  
1024 - * 群创建时间  
1025 - */ 904 +
  905 +///群创建时间
1026 @property(nonatomic,assign) uint32_t createTime; 906 @property(nonatomic,assign) uint32_t createTime;
1027 -/**  
1028 - * 最近一次群资料修改时间  
1029 - */ 907 +
  908 +///最近一次群资料修改时间
1030 @property(nonatomic,assign) uint32_t lastInfoTime; 909 @property(nonatomic,assign) uint32_t lastInfoTime;
1031 -/**  
1032 - * 最近一次发消息时间  
1033 - */ 910 +
  911 +///最近一次发消息时间
1034 @property(nonatomic,assign) uint32_t lastMsgTime; 912 @property(nonatomic,assign) uint32_t lastMsgTime;
1035 -/**  
1036 - * 最大成员数  
1037 - */ 913 +
  914 +///最大成员数
1038 @property(nonatomic,assign) uint32_t maxMemberNum; 915 @property(nonatomic,assign) uint32_t maxMemberNum;
1039 -/**  
1040 - * 群成员数量  
1041 - */ 916 +
  917 +///群成员数量
1042 @property(nonatomic,assign) uint32_t memberNum; 918 @property(nonatomic,assign) uint32_t memberNum;
1043 919
1044 -/**  
1045 - * 入群类型  
1046 - */ 920 +///入群类型
1047 @property(nonatomic,assign) TIMGroupAddOpt addOpt; 921 @property(nonatomic,assign) TIMGroupAddOpt addOpt;
1048 922
1049 -/**  
1050 - * 群公告  
1051 - */ 923 +///群公告
1052 @property(nonatomic,strong) NSString* notification; 924 @property(nonatomic,strong) NSString* notification;
1053 925
1054 -/**  
1055 - * 群简介  
1056 - */ 926 +///群简介
1057 @property(nonatomic,strong) NSString* introduction; 927 @property(nonatomic,strong) NSString* introduction;
1058 928
1059 -/**  
1060 - * 群头像  
1061 - */ 929 +///群头像
1062 @property(nonatomic,strong) NSString* faceURL; 930 @property(nonatomic,strong) NSString* faceURL;
1063 931
1064 -/**  
1065 - * 最后一条消息  
1066 - */ 932 +///最后一条消息
1067 @property(nonatomic,strong) TIMMessage* lastMsg; 933 @property(nonatomic,strong) TIMMessage* lastMsg;
1068 934
1069 -/**  
1070 - * 在线成员数量  
1071 - */ 935 +///在线成员数量
1072 @property(nonatomic,assign) uint32_t onlineMemberNum; 936 @property(nonatomic,assign) uint32_t onlineMemberNum;
1073 937
1074 -/**  
1075 - * 群组是否被搜索类型  
1076 - */ 938 +///群组是否被搜索类型
1077 @property(nonatomic,assign) TIMGroupSearchableType isSearchable; 939 @property(nonatomic,assign) TIMGroupSearchableType isSearchable;
1078 940
1079 -/**  
1080 - * 群组成员可见类型  
1081 - */ 941 +///群组成员可见类型
1082 @property(nonatomic,assign) TIMGroupMemberVisibleType isMemberVisible; 942 @property(nonatomic,assign) TIMGroupMemberVisibleType isMemberVisible;
1083 943
1084 -/**  
1085 - 是否全员禁言  
1086 - */ 944 +///是否全员禁言
1087 @property(nonatomic,assign) BOOL allShutup; 945 @property(nonatomic,assign) BOOL allShutup;
1088 946
1089 -/**  
1090 - * 群组中的本人信息  
1091 - */ 947 +///群组中的本人信息
1092 @property(nonatomic,strong) TIMGroupSelfInfo* selfInfo; 948 @property(nonatomic,strong) TIMGroupSelfInfo* selfInfo;
1093 949
1094 -/**  
1095 - * 自定义字段集合,key是NSString*类型,value是NSData*类型  
1096 - */  
1097 -@property(nonatomic,strong) NSDictionary* customInfo; 950 +///自定义字段集合,key 是 NSString* 类型,value 是 NSData* 类型
  951 +@property(nonatomic,strong) NSDictionary<NSString *,NSData *>* customInfo;
1098 952
1099 @end 953 @end
1100 954
1101 -/**  
1102 - * 事件上报信息  
1103 - */ 955 +/// 事件上报信息
1104 @interface TIMEventReportItem : NSObject 956 @interface TIMEventReportItem : NSObject
1105 -/**  
1106 - * 事件id  
1107 - */ 957 +
  958 +///事件 id
1108 @property(nonatomic,assign) uint32_t event; 959 @property(nonatomic,assign) uint32_t event;
1109 -/**  
1110 - * 错误码  
1111 - */ 960 +
  961 +///错误码
1112 @property(nonatomic,assign) uint32_t code; 962 @property(nonatomic,assign) uint32_t code;
1113 -/**  
1114 - * 错误描述  
1115 - */ 963 +
  964 +///错误描述
1116 @property(nonatomic,strong) NSString * desc; 965 @property(nonatomic,strong) NSString * desc;
1117 -/**  
1118 - * 事件延迟(单位ms)  
1119 - */ 966 +
  967 +///事件延迟(单位 ms)
1120 @property(nonatomic,assign) uint32_t delay; 968 @property(nonatomic,assign) uint32_t delay;
1121 969
1122 @end 970 @end
1123 971
  972 +/// 获取某个群组资料
1124 @interface TIMGroupInfoOption : NSObject 973 @interface TIMGroupInfoOption : NSObject
1125 974
1126 -/**  
1127 - * 需要获取的群组信息标志(TIMGetGroupBaseInfoFlag),默认为0xffffff  
1128 - */ 975 +///需要获取的群组信息标志(TIMGetGroupBaseInfoFlag),默认为0xffffff
1129 @property(nonatomic,assign) uint64_t groupFlags; 976 @property(nonatomic,assign) uint64_t groupFlags;
1130 977
1131 -/**  
1132 - * 需要获取群组资料的自定义信息(NSString*)列表  
1133 - */ 978 +///需要获取群组资料的自定义信息(NSString*)列表
1134 @property(nonatomic,strong) NSArray * groupCustom; 979 @property(nonatomic,strong) NSArray * groupCustom;
1135 980
1136 @end 981 @end
1137 982
  983 +/// 需要某个群成员资料
1138 @interface TIMGroupMemberInfoOption : NSObject 984 @interface TIMGroupMemberInfoOption : NSObject
1139 985
1140 -/**  
1141 - * 需要获取的群成员标志(TIMGetGroupMemInfoFlag),默认为0xffffff  
1142 - */ 986 +///需要获取的群成员标志(TIMGetGroupMemInfoFlag),默认为0xffffff
1143 @property(nonatomic,assign) uint64_t memberFlags; 987 @property(nonatomic,assign) uint64_t memberFlags;
1144 988
1145 -/**  
1146 - * 需要获取群成员资料的自定义信息(NSString*)列表  
1147 - */ 989 +///需要获取群成员资料的自定义信息(NSString*)列表
1148 @property(nonatomic,strong) NSArray * memberCustom; 990 @property(nonatomic,strong) NSArray * memberCustom;
1149 991
1150 @end 992 @end
1151 993
1152 -/**  
1153 - * 成员操作返回值  
1154 - */ 994 +/// 群成员资料
1155 @interface TIMGroupMemberInfo : TIMCodingModel 995 @interface TIMGroupMemberInfo : TIMCodingModel
1156 996
1157 -/**  
1158 - * 被操作成员  
1159 - */ 997 +///成员
1160 @property(nonatomic,strong) NSString* member; 998 @property(nonatomic,strong) NSString* member;
1161 999
1162 -/**  
1163 - * 群名片  
1164 - */ 1000 +///群名片
1165 @property(nonatomic,strong) NSString* nameCard; 1001 @property(nonatomic,strong) NSString* nameCard;
1166 1002
1167 -/**  
1168 - * 加入群组时间  
1169 - */ 1003 +///加入群组时间
1170 @property(nonatomic,assign) time_t joinTime; 1004 @property(nonatomic,assign) time_t joinTime;
1171 1005
1172 -/**  
1173 - * 成员类型  
1174 - */ 1006 +///成员类型
1175 @property(nonatomic,assign) TIMGroupMemberRole role; 1007 @property(nonatomic,assign) TIMGroupMemberRole role;
1176 1008
1177 -/**  
1178 - * 禁言结束时间(时间戳)  
1179 - */ 1009 +///禁言结束时间(时间戳)
1180 @property(nonatomic,assign) uint32_t silentUntil; 1010 @property(nonatomic,assign) uint32_t silentUntil;
1181 1011
1182 -/**  
1183 - * 自定义字段集合,key是NSString*类型,value是NSData*类型  
1184 - */ 1012 +///自定义字段集合,key 是 NSString*类型,value 是 NSData*类型
1185 @property(nonatomic,strong) NSDictionary* customInfo; 1013 @property(nonatomic,strong) NSDictionary* customInfo;
1186 1014
1187 @end 1015 @end
1188 1016
  1017 +///资料与关系链
1189 @interface TIMFriendProfileOption : NSObject 1018 @interface TIMFriendProfileOption : NSObject
1190 1019
1191 -/**  
1192 - * 需要获取的好友信息标志(TIMProfileFlag),默认为0xffffff  
1193 - */  
1194 -@property(nonatomic,assign) uint64_t friendFlags;  
1195 -  
1196 -/**  
1197 - * 需要获取的好友自定义信息(NSString*)列表  
1198 - */  
1199 -@property(nonatomic,strong) NSArray * friendCustom;  
1200 -  
1201 -/**  
1202 - * 需要获取的用户自定义信息(NSString*)列表  
1203 - */  
1204 -@property(nonatomic,strong) NSArray * userCustom; 1020 +///关系链最大缓存时间(默认缓存一天;获取资料和关系链超过缓存时间,将自动向服务器发起请求)
  1021 +@property NSInteger expiredSeconds;
1205 1022
1206 @end 1023 @end
1207 1024
1208 -/**  
1209 - * 好友资料  
1210 - */ 1025 +///用户资料
1211 @interface TIMUserProfile : TIMCodingModel 1026 @interface TIMUserProfile : TIMCodingModel
1212 1027
1213 /** 1028 /**
1214 - * 用户identifier 1029 + * 用户 identifier
1215 */ 1030 */
1216 @property(nonatomic,strong) NSString* identifier; 1031 @property(nonatomic,strong) NSString* identifier;
1217 1032
@@ -1221,11 +1036,6 @@ typedef void (^TIMGetProfileSucc)(TIMUserProfile * profile); @@ -1221,11 +1036,6 @@ typedef void (^TIMGetProfileSucc)(TIMUserProfile * profile);
1221 @property(nonatomic,strong) NSString* nickname; 1036 @property(nonatomic,strong) NSString* nickname;
1222 1037
1223 /** 1038 /**
1224 - * 用户备注(最大96字节,获取自己资料时,该字段为空)  
1225 - */  
1226 -@property(nonatomic,strong) NSString* remark;  
1227 -  
1228 -/**  
1229 * 好友验证方式 1039 * 好友验证方式
1230 */ 1040 */
1231 @property(nonatomic,assign) TIMFriendAllowType allowType; 1041 @property(nonatomic,assign) TIMFriendAllowType allowType;
@@ -1241,22 +1051,22 @@ typedef void (^TIMGetProfileSucc)(TIMUserProfile * profile); @@ -1241,22 +1051,22 @@ typedef void (^TIMGetProfileSucc)(TIMUserProfile * profile);
1241 @property(nonatomic,strong) NSData* selfSignature; 1051 @property(nonatomic,strong) NSData* selfSignature;
1242 1052
1243 /** 1053 /**
1244 - * 好友性别 1054 + * 用户性别
1245 */ 1055 */
1246 @property(nonatomic,assign) TIMGender gender; 1056 @property(nonatomic,assign) TIMGender gender;
1247 1057
1248 /** 1058 /**
1249 - * 好友生日 1059 + * 用户生日
1250 */ 1060 */
1251 @property(nonatomic,assign) uint32_t birthday; 1061 @property(nonatomic,assign) uint32_t birthday;
1252 1062
1253 /** 1063 /**
1254 - * 好友区域 1064 + * 用户区域
1255 */ 1065 */
1256 @property(nonatomic,strong) NSData* location; 1066 @property(nonatomic,strong) NSData* location;
1257 1067
1258 /** 1068 /**
1259 - * 好友语言 1069 + * 用户语言
1260 */ 1070 */
1261 @property(nonatomic,assign) uint32_t language; 1071 @property(nonatomic,assign) uint32_t language;
1262 1072
@@ -1271,16 +1081,61 @@ typedef void (^TIMGetProfileSucc)(TIMUserProfile * profile); @@ -1271,16 +1081,61 @@ typedef void (^TIMGetProfileSucc)(TIMUserProfile * profile);
1271 @property(nonatomic,assign) uint32_t role; 1081 @property(nonatomic,assign) uint32_t role;
1272 1082
1273 /** 1083 /**
1274 - * 好友分组名称 NSString* 列表 1084 + * 自定义字段集合,key是NSString类型,value是NSData类型或者NSNumber类型
  1085 + * key值按照后台配置的字符串传入,不包括 TIMProfileTypeKey_Custom_Prefix 前缀
  1086 + */
  1087 +@property(nonatomic,strong) NSDictionary* customInfo;
  1088 +
  1089 +@end
  1090 +
  1091 +typedef void(^ProfileCallBack) (TIMUserProfile * proflie);
  1092 +
  1093 +/**
  1094 + * 好友
1275 */ 1095 */
1276 -@property(nonatomic,strong) NSArray* friendGroups; 1096 +@interface TIMFriend : TIMCodingModel
  1097 +
  1098 +/**
  1099 + * 好友identifier
  1100 + */
  1101 +@property(nonatomic,strong) NSString *identifier;
  1102 +
  1103 +/**
  1104 + * 好友备注(最大96字节,获取自己资料时,该字段为空)
  1105 + */
  1106 +@property(nonatomic,strong) NSString *remark;
  1107 +
  1108 +/**
  1109 + * 分组名称 NSString* 列表
  1110 + */
  1111 +@property(nonatomic,strong) NSArray *groups;
  1112 +
  1113 +/**
  1114 + * 申请时的添加理由
  1115 + */
  1116 +@property(nonatomic,strong) NSString *addWording;
  1117 +
  1118 +/**
  1119 + * 申请时的添加来源
  1120 + */
  1121 +@property(nonatomic,strong) NSString *addSource;
  1122 +
  1123 +/**
  1124 + * 添加时间
  1125 + */
  1126 +@property(nonatomic,assign) uint64_t addTime;
1277 1127
1278 /** 1128 /**
1279 * 自定义字段集合,key是NSString类型,value是NSData类型或者NSNumber类型 1129 * 自定义字段集合,key是NSString类型,value是NSData类型或者NSNumber类型
1280 - * (key值按照后台配置的字符串传入) 1130 + * key值按照后台配置的字符串传入,不包括 TIMFriendTypeKey_Custom_Prefix 前缀
1281 */ 1131 */
1282 @property(nonatomic,strong) NSDictionary* customInfo; 1132 @property(nonatomic,strong) NSDictionary* customInfo;
1283 1133
  1134 +/**
  1135 + * 好友资料
  1136 + */
  1137 +@property(nonatomic,strong) TIMUserProfile *profile;
  1138 +
1284 @end 1139 @end
1285 1140
1286 #endif 1141 #endif
@@ -9,93 +9,100 @@ @@ -9,93 +9,100 @@
9 #ifndef TIMConversation_h 9 #ifndef TIMConversation_h
10 #define TIMConversation_h 10 #define TIMConversation_h
11 11
12 -#import "ImSDK.h" 12 +#import "TIMConversation.h"
13 #import "TIMMessage+MsgExt.h" 13 #import "TIMMessage+MsgExt.h"
14 14
15 @interface TIMConversation (MsgExt) 15 @interface TIMConversation (MsgExt)
16 16
17 /** 17 /**
18 - * 保存消息到消息列表,这里只保存在本地 18 + * 保存会话消息
  19 + *
  20 + * 保存消息到消息列表,这里只保存在本地。
19 * 21 *
20 * @param msg 消息体 22 * @param msg 消息体
21 * @param sender 发送方 23 * @param sender 发送方
22 * @param isReaded 是否已读,如果发送方是自己,默认已读 24 * @param isReaded 是否已读,如果发送方是自己,默认已读
23 * 25 *
24 - * @return 0 成功 26 + * @return 0:成功;1:失败
25 */ 27 */
26 - (int)saveMessage:(TIMMessage*)msg sender:(NSString*)sender isReaded:(BOOL)isReaded; 28 - (int)saveMessage:(TIMMessage*)msg sender:(NSString*)sender isReaded:(BOOL)isReaded;
27 29
28 /** 30 /**
29 - * 获取会话消息 31 + * 获取会话漫游消息
  32 + *
  33 + * 1. 登录后可以获取漫游消息,单聊和群聊消息免费漫游7天,用户有额外消息漫游需求时,可前往 [IM 控制台](https://console.cloud.tencent.com/avc) -> 功能配置 -> 消息 ->消息漫游时长 购买,具体资费请参考 [价格说明](https://cloud.tencent.com/document/product/269/11673)。
  34 + * 2. 如果本地消息全部都是连续的,则不会通过网络获取,如果本地消息不连续,会通过网络获取断层消息。
  35 + * 3. 对于图片、语音等资源类消息,消息体只会包含描述信息,需要通过额外的接口下载数据,详情请参考 [消息收发](https://cloud.tencent.com/document/product/269/9150)中的 "消息解析" 部分文档。
30 * 36 *
31 * @param count 获取数量 37 * @param count 获取数量
32 - * @param last 上次最后一条消息 38 + * @param last 上次最后一条消息,如果 last 为 nil,从最新的消息开始读取
33 * @param succ 成功时回调 39 * @param succ 成功时回调
34 * @param fail 失败时回调 40 * @param fail 失败时回调
35 * 41 *
36 - * @return 0 本次操作成功 42 + * @return 0:本次操作成功;1:本次操作失败
37 */ 43 */
38 - (int)getMessage:(int)count last:(TIMMessage*)last succ:(TIMGetMsgSucc)succ fail:(TIMFail)fail; 44 - (int)getMessage:(int)count last:(TIMMessage*)last succ:(TIMGetMsgSucc)succ fail:(TIMFail)fail;
39 45
40 /** 46 /**
41 - * 向前获取会话消息 47 + * 向前获取会话漫游消息
  48 + *
  49 + * 调用方式和 getMessage 一样,区别是 getMessage 获取的是时间更老的消息,主要用于下拉 Tableview 刷新消息数据,getMessageForward 获取的是时间更新的消息,主要用于上拉 Tableview 刷新消息数据。
42 * 50 *
43 * @param count 获取数量 51 * @param count 获取数量
44 - * @param last 上次最后一条消息 52 + * @param last 上次最后一条消息,如果 last 为 nil,从最新的消息开始读取
45 * @param succ 成功时回调 53 * @param succ 成功时回调
46 * @param fail 失败时回调 54 * @param fail 失败时回调
47 * 55 *
48 - * @return 0 本次操作成功 56 + * @return 0:本次操作成功;1:本次操作失败
49 */ 57 */
50 - (int)getMessageForward:(int)count last:(TIMMessage*)last succ:(TIMGetMsgSucc)succ fail:(TIMFail)fail; 58 - (int)getMessageForward:(int)count last:(TIMMessage*)last succ:(TIMGetMsgSucc)succ fail:(TIMFail)fail;
51 59
52 /** 60 /**
53 * 获取本地会话消息 61 * 获取本地会话消息
54 * 62 *
  63 + * 1. 对于单聊,登录后可以获取本地缓存消息
  64 + * 2. 对于群组,开启最近联系人漫游(登录之后 SDK 默认开启,可以通过 TIMUserConfig 里面的 disableRecnetContact 关闭)的情况下,登录后只能获取最近一条消息,可通过 getMessage 获取漫游消息
  65 + *
55 * @param count 获取数量 66 * @param count 获取数量
56 * @param last 上次最后一条消息 67 * @param last 上次最后一条消息
57 * @param succ 成功时回调 68 * @param succ 成功时回调
58 * @param fail 失败时回调 69 * @param fail 失败时回调
59 * 70 *
60 - * @return 0 本次操作成功 71 + * @return 0:本次操作成功;1:本次操作失败
61 */ 72 */
62 - (int)getLocalMessage:(int)count last:(TIMMessage*)last succ:(TIMGetMsgSucc)succ fail:(TIMFail)fail; 73 - (int)getLocalMessage:(int)count last:(TIMMessage*)last succ:(TIMGetMsgSucc)succ fail:(TIMFail)fail;
63 74
64 /** 75 /**
65 - * 获取会话消息 76 + * 获取指定会话消息
66 * 77 *
67 * @param locators 消息定位符(TIMMessageLocator)数组 78 * @param locators 消息定位符(TIMMessageLocator)数组
68 * @param succ 成功时回调 79 * @param succ 成功时回调
69 * @param fail 失败时回调 80 * @param fail 失败时回调
70 * 81 *
71 - * @return 0 本次操作成功 82 + * @return 0:本次操作成功;1:本次操作失败
72 */ 83 */
73 - (int)findMessages:(NSArray*)locators succ:(TIMGetMsgSucc)succ fail:(TIMFail)fail; 84 - (int)findMessages:(NSArray*)locators succ:(TIMGetMsgSucc)succ fail:(TIMFail)fail;
74 85
75 /** 86 /**
76 - * 撤回消息(仅C2C和GROUP会话有效、onlineMessage无效、AVChatRoom和BChatRoom无效) 87 + * 撤回消息
  88 + *
  89 + * 1. 仅 C2C 和 GROUP 会话有效、onlineMessage 无效、AVChatRoom 和 BChatRoom 无效。
  90 + * 2. 可以在 TIMUserConfig 设置的 TIMMessageRevokeListener 监听 onRevokeMessage 消息撤回回调。
  91 + * 3. 遍历本地消息列表,如果消息的 respondsToLocator 函数返回 YES,则是对应的消息,您可以在 UI 上执行删除操作,具体可以参考 TUIMessageController.h 里面的 onRevokeMessage 回调的实现。
77 * 92 *
78 * @param msg 被撤回的消息 93 * @param msg 被撤回的消息
79 * @param succ 成功时回调 94 * @param succ 成功时回调
80 * @param fail 失败时回调 95 * @param fail 失败时回调
81 * 96 *
82 - * @return 0 本次操作成功 97 + * @return 0:本次操作成功;1:本次操作失败
83 */ 98 */
84 - (int)revokeMessage:(TIMMessage*)msg succ:(TIMSucc)succ fail:(TIMFail)fail; 99 - (int)revokeMessage:(TIMMessage*)msg succ:(TIMSucc)succ fail:(TIMFail)fail;
85 100
86 /** 101 /**
87 - * 同步本会话的消息撤回通知(仅GROUP会话有效)  
88 - *  
89 - * @param succ 成功时回调,同步的通知会通过TIMMessageRevokeListener抛出  
90 - * @param fail 失败时回调  
91 - *  
92 - * @return 0 本次操作成功  
93 - */  
94 -- (int)syncRevokeNotify:(TIMSucc)succ fail:(TIMFail)fail;  
95 -  
96 -/**  
97 * 删除本地会话消息 102 * 删除本地会话消息
98 * 103 *
  104 + * 可以在保留会话同时删除本地的会话消息。
  105 + *
99 * @param succ 成功时回调 106 * @param succ 成功时回调
100 * @param fail 失败时回调 107 * @param fail 失败时回调
101 * 108 *
@@ -106,7 +113,11 @@ @@ -106,7 +113,11 @@
106 /** 113 /**
107 * 设置已读消息 114 * 设置已读消息
108 * 115 *
109 - * @param readed 会话内最近一条已读的消息,nil表示上报最新消息 116 + * 1. 如果在 TIMUserConfig 关闭了自动已读上报(设置 disableAutoReport 为 YES),这里需要显示调用 setReadMessage ,消息的已读状态才会改变。
  117 + * 2. 如果在 TIMUserConfig 开启了消息回执(设置 enableReadReceipt 为 YES),收消息的用户需要显示调用 setReadMessage ,发消息的用户才能通过 TIMMessageReceiptListener 监听到消息的已读回执。
  118 + * 3. 如果您需要设置单条消息的已读状态,请使用 TIMMessage+MsgExt.h 中的 setCustomInt 自定义字段接口设置,通过 customInt 获取,需要注意的是,这个接口设置的字段只在本地保存,如果切换了终端,或则 APP 被卸载,这个值都会失效。
  119 + *
  120 + * @param readed 会话内最近一条已读的消息,nil 表示上报最新消息
110 * 121 *
111 * @param succ 成功时回调 122 * @param succ 成功时回调
112 * @param fail 失败时回调 123 * @param fail 失败时回调
@@ -116,7 +127,10 @@ @@ -116,7 +127,10 @@
116 - (int)setReadMessage:(TIMMessage*)readed succ:(TIMSucc)succ fail:(TIMFail)fail; 127 - (int)setReadMessage:(TIMMessage*)readed succ:(TIMSucc)succ fail:(TIMFail)fail;
117 128
118 /** 129 /**
119 - * 获取该会话的未读计数 130 + * 获取会话的未读计数
  131 + *
  132 + * 1. 单终端,未卸载 APP 的情况下,您可以通过当前接口获取准确的未读计数。
  133 + * 2. 如果需要在多终端或则程序 APP 卸载重装后未读计数依然准确,请设置 TIMUserConfig 的 disableAutoReport 为 YES,然后显示调用 setReadMessage。详情请参考 [未读消息计数](https://cloud.tencent.com/document/product/269/9151)
120 * 134 *
121 * @return 返回未读计数 135 * @return 返回未读计数
122 */ 136 */
@@ -134,32 +148,28 @@ @@ -134,32 +148,28 @@
134 * 148 *
135 * @param msgs 消息(TIMMessage*)列表 149 * @param msgs 消息(TIMMessage*)列表
136 * 150 *
137 - * @return 0 成功 151 + * @return 0:成功;1:失败
138 */ 152 */
139 - (int)importMessages:(NSArray*)msgs; 153 - (int)importMessages:(NSArray*)msgs;
140 154
141 /** 155 /**
142 * 设置会话草稿 156 * 设置会话草稿
143 * 157 *
144 - * @param draft 草稿内容 158 + * UI 展示最近联系人列表时,时常会展示用户的草稿内容,ImSDK 提供了设置和获取草稿的接口,用户可以通过此接口设置会话的草稿信息。草稿信息会存本地数据库,重新登录后依然可以获取。
  159 + *
  160 + * @param draft 草稿内容,详情请参考 TIMMessage+MsgExt.h 里面的 TIMMessageDraft 定义
145 * 161 *
146 - * @return 0 成功 162 + * @return 0:成功;1:失败
147 */ 163 */
148 - (int)setDraft:(TIMMessageDraft*)draft; 164 - (int)setDraft:(TIMMessageDraft*)draft;
149 165
150 /** 166 /**
151 * 获取会话草稿 167 * 获取会话草稿
152 * 168 *
153 - * @return 草稿内容,没有草稿返回nil 169 + * @return 草稿内容,没有草稿返回 nil
154 */ 170 */
155 - (TIMMessageDraft*)getDraft; 171 - (TIMMessageDraft*)getDraft;
156 172
157 -/**  
158 - * 禁用本会话的存储,只对当前初始化有效,重启后需要重新设置  
159 - * 需要 initSdk 之后调用  
160 - */  
161 -- (void)disableStorage;  
162 -  
163 @end 173 @end
164 174
165 #endif /* TIMConversation_h */ 175 #endif /* TIMConversation_h */
@@ -22,34 +22,45 @@ @@ -22,34 +22,45 @@
22 /** 22 /**
23 * 发送消息 23 * 发送消息
24 * 24 *
  25 + * TIMMessage 由多个 TIMElem 组成,每个 TIMElem 可以是文本和图片,也就是说每一条消息可包含多个文本和多张图片。详情请参考官网文档 [消息收发](https://cloud.tencent.com/document/product/269/9150)
  26 + *
25 * @param msg 消息体 27 * @param msg 消息体
26 * @param succ 发送成功时回调 28 * @param succ 发送成功时回调
27 * @param fail 发送失败时回调 29 * @param fail 发送失败时回调
28 * 30 *
29 - * @return 0 本次操作成功 31 + * @return 0:操作成功;1:操作失败
30 */ 32 */
31 - (int)sendMessage:(TIMMessage*)msg succ:(TIMSucc)succ fail:(TIMFail)fail; 33 - (int)sendMessage:(TIMMessage*)msg succ:(TIMSucc)succ fail:(TIMFail)fail;
32 34
33 /** 35 /**
34 * 发送在线消息(服务器不保存消息) 36 * 发送在线消息(服务器不保存消息)
35 * 37 *
  38 + * 1. 对于某些场景,需要发送在线消息,即用户在线时收到消息,如果用户不在线,下次登录也不会看到消息,可用于通知类消息,这种消息不会进行存储,也不会计入未读计数。发送接口与 sendMessage 类似。
  39 + * 2. 暂不支持 AVChatRoom 和 BChatRoom 类型。
  40 + *
36 * @param msg 消息体 41 * @param msg 消息体
37 * @param succ 成功回调 42 * @param succ 成功回调
38 * @param fail 失败回调 43 * @param fail 失败回调
39 * 44 *
40 - * @return 0 成功 45 + * @return 0:操作成功;1:操作失败
41 */ 46 */
42 - (int)sendOnlineMessage:(TIMMessage*)msg succ:(TIMSucc)succ fail:(TIMFail)fail; 47 - (int)sendOnlineMessage:(TIMMessage*)msg succ:(TIMSucc)succ fail:(TIMFail)fail;
43 48
44 /** 49 /**
45 - * 获取会话人,单聊为对方账号,群聊为群组Id 50 + * 获取会话人
  51 + *
  52 + * C2C:对方账号;Group:群组Id。
  53 + *
  54 + * 对同一个 C2C 会话或则群聊会话,getReceiver 获取的会话人都是固定的,C2C 获取的是对方账号,Group 获取的是群组 Id。
46 * 55 *
47 * @return 会话人 56 * @return 会话人
48 */ 57 */
49 - (NSString*)getReceiver; 58 - (NSString*)getReceiver;
50 59
51 /** 60 /**
52 - * 获取群名称(只有群会话有效) 61 + * 获取群名称
  62 + *
  63 + * 获取群名称,只有群会话有效。
53 * 64 *
54 * @return 群名称 65 * @return 群名称
55 */ 66 */
@@ -63,9 +74,9 @@ @@ -63,9 +74,9 @@
63 - (TIMConversationType)getType; 74 - (TIMConversationType)getType;
64 75
65 /** 76 /**
66 - * 获取该会话所属用户的id 77 + * 获取自己的 id
67 * 78 *
68 - * @return 用户id 79 + * @return 用户 id
69 */ 80 */
70 - (NSString*)getSelfIdentifier; 81 - (NSString*)getSelfIdentifier;
71 82
  1 +//
  2 +// TIMErrorCode.h
  3 +// ImSDK
  4 +//
  5 +// Created by jameskhdeng on 2018/11/23.
  6 +// Copyright © 2018 tencent. All rights reserved.
  7 +//
  8 +
  9 +#ifndef TIMErrorCode_h
  10 +#define TIMErrorCode_h
  11 +
  12 +enum ERROR_CODE {
  13 + ERR_SUCC = 0,
  14 + ERR_PARSE_RESPONSE_FAILED = 6001, //解析响应失败
  15 + ERR_SERIALIZE_REQ_FAILED = 6002, //序列化请求失败
  16 + ERR_NO_SUCC_RESULT = 6003, //批量操作无成功结果
  17 + ERR_INVALID_CONVERSATION = 6004, //IM: 无效会话
  18 + ERR_LOADMSG_FAILED = 6005, //IM: 加载本地消息存储失败
  19 + ERR_FILE_TRANS_AUTH_FAILED = 6006, //IM: 文件传输 - 鉴权失败
  20 + ERR_FILE_TRANS_NO_SERVER = 6007, //IM: 文件传输 - 获取svr失败
  21 + ERR_FILE_TRANS_UPLOAD_FAILED = 6008, //IM: 文件传输 - 上传失败
  22 + ERR_FILE_TRANS_DOWNLOAD_FAILED = 6009, //IM: 文件传输 - 下载失败
  23 + ERR_HTTP_REQ_FAILED = 6010, //HTTP请求失败
  24 + ERR_TO_USER_INVALID = 6011, //IM: 无效接收方
  25 + ERR_REQUEST_TIMEOUT = 6012, //请求超时
  26 + ERR_SDK_NOT_INITIALIZED = 6013, //SDK未初始化
  27 + ERR_SDK_NOT_LOGGED_IN = 6014, //SDK未登录
  28 + ERR_IN_PROGESS = 6015, //执行中
  29 + ERR_INVALID_MSG_ELEM = 6016, //IM: 无效消息elem
  30 + ERR_INVALID_PARAMETERS = 6017, //API参数无效
  31 + ERR_INIT_CORE_FAIL = 6018, //INIT CORE模块失败
  32 + ERR_DATABASE_OPERATE_FAILED = 6019, //本地数据库操作失败
  33 + ERR_EXPIRED_SESSION_NODE = 6020, //SessionNode为null
  34 + ERR_INVALID_SDK_OBJECT = 6021, //无效的imsdk对象,例如用户自己生成TIMImage,或内部赋值错误导致的sdk对象无效
  35 + ERR_IO_OPERATION_FAILED = 6022, //本地IO操作失败
  36 + ERR_LOGGED_OUT_BEFORE_LOGIN_FINISHED = 6023, //在登录完成前进行了登出(在登录时返回)
  37 + ERR_TLSSDK_NOT_INITIALIZED = 6024, //tlssdk未初始化
  38 + ERR_TLSSDK_USER_NOT_FOUND = 6025, //TLSSDK没有找到相应的用户信息
  39 + ERR_NO_PREVIOUS_LOGIN = 6026, //自动登陆时并没有登陆过该用户
  40 +
  41 + ERR_BIND_FAIL_UNKNOWN = 6100, //QALSDK未知原因BIND失败
  42 + ERR_BIND_FAIL_NO_SSOTICKET = 6101, //缺少SSO票据
  43 + ERR_BIND_FAIL_REPEATD_BIND = 6102, //重复BIND
  44 + ERR_BIND_FAIL_TINYID_NULL = 6103, //tiny为空
  45 + ERR_BIND_FAIL_GUID_NULL = 6104, //guid为空
  46 + ERR_BIND_FAIL_UNPACK_REGPACK_FAILED = 6105, //解注册包失败
  47 + ERR_BIND_FAIL_REG_TIMEOUT = 6106, //注册超时
  48 + ERR_BIND_FAIL_ISBINDING = 6107, //正在bind操作中
  49 +
  50 + ERR_PACKET_FAIL_UNKNOWN = 6120, //发包未知错误
  51 + ERR_PACKET_FAIL_REQ_NO_NET = 6121, //发送请求包时没有网络,处理时转换成ERR_REQ_NO_NET_ON_REQ
  52 + ERR_PACKET_FAIL_RESP_NO_NET = 6122, //发送回复包时没有网络,处理时转换成ERR_REQ_NO_NET_ON_RSP
  53 + ERR_PACKET_FAIL_REQ_NO_AUTH = 6123, //发送请求包时没有权限
  54 + ERR_PACKET_FAIL_SSO_ERR = 6124, //SSO错误
  55 + ERR_PACKET_FAIL_REQ_TIMEOUT = 6125, //请求超时,处理时转化成ERR_REQUEST_TIMEOUT
  56 + ERR_PACKET_FAIL_RESP_TIMEOUT = 6126, //回复超时,处理时转化成ERR_REQUEST_TIMEOUT
  57 + ERR_PACKET_FAIL_REQ_ON_RESEND = 6127, //
  58 + ERR_PACKET_FAIL_RESP_NO_RESEND = 6128, //
  59 + ERR_PACKET_FAIL_FLOW_SAVE_FILTERED = 6129, //
  60 + ERR_PACKET_FAIL_REQ_OVER_LOAD = 6130, //
  61 + ERR_PACKET_FAIL_LOGIC_ERR = 6131,
  62 +
  63 + ERR_FRIENDSHIP_PROXY_NOT_SYNCED = 6150, // proxy_manager没有完成svr数据同步
  64 + ERR_FRIENDSHIP_PROXY_SYNCING = 6151, // proxy_manager正在进行svr数据同步
  65 + ERR_FRIENDSHIP_PROXY_SYNCED_FAIL = 6152, // proxy_manager同步失败
  66 + ERR_FRIENDSHIP_PROXY_LOCAL_CHECK_ERR = 6153, // proxy_manager请求参数,在本地检查不合法
  67 +
  68 + ERR_GROUP_INVALID_FIELD = 6160, // group assistant请求字段中包含非预设字段
  69 + ERR_GROUP_STORAGE_DISABLED = 6161, // group assistant群资料本地存储没有开启
  70 + ERR_LOADGRPINFO_FAILED = 6162, // failed to load groupinfo from storage
  71 +
  72 + ERR_REQ_NO_NET_ON_REQ = 6200, // 请求的时候没有网络
  73 + ERR_REQ_NO_NET_ON_RSP = 6201, // 响应的时候没有网络
  74 + ERR_SERIVCE_NOT_READY = 6205, // QALSDK服务未就绪
  75 + ERR_USER_SIG_EXPIRED = 6206, // 票据过期
  76 + ERR_LOGIN_AUTH_FAILED = 6207, // 账号认证失败(tinyid转换失败)
  77 + ERR_LOGIN_KICKED_OFF_BY_OTHER = 6208, // 账号被踢
  78 + ERR_NEVER_CONNECT_AFTER_LAUNCH = 6209, // 在应用启动后没有尝试联网
  79 +
  80 + ERR_REQ_FAILED = 6210, // QAL执行失败
  81 + ERR_REQ_INVALID_REQ = 6211, // 请求非法,toMsgService非法
  82 + ERR_REQ_OVERLOADED = 6212, // 请求队列満
  83 + ERR_REQ_KICK_OFF = 6213, // 已经被其他终端踢了
  84 + ERR_REQ_SERVICE_SUSPEND = 6214, // 服务被暂停
  85 + ERR_REQ_INVALID_SIGN = 6215, // SSO签名错误
  86 + ERR_REQ_INVALID_COOKIE = 6216, // SSO cookie无效
  87 + ERR_LOGIN_TLS_RSP_PARSE_FAILED = 6217, // 登录时TLS回包校验,包体长度错误
  88 + ERR_LOGIN_OPENMSG_TIMEOUT = 6218, // 登录时OPENSTATSVC向OPENMSG上报状态超时
  89 + ERR_LOGIN_OPENMSG_RSP_PARSE_FAILED = 6219, // 登录时OPENSTATSVC向OPENMSG上报状态时解析回包失败
  90 + ERR_LOGIN_TLS_DECRYPT_FAILED = 6220, // 登录时TLS解密失败
  91 + ERR_WIFI_NEED_AUTH = 6221, // wifi需要认证
  92 +
  93 + ERR_USER_CANCELED = 6222, // 用户已取消
  94 +
  95 + ERR_REVOKE_TIME_LIMIT_EXCEED = 6223, //消息撤回超过了时间限制(默认2分钟)
  96 + ERR_LACK_UGC_EXT = 6224, // 缺少UGC扩展包
  97 + ERR_AUTOLOGIN_NEED_USERSIG = 6226, //自动登录,本地票据过期,需要userSig手动登录
  98 +
  99 +
  100 + ERR_REQ_CONTENT_ATTACK = 80001, // 消息内容安全打击
  101 +
  102 + ERR_LOGIN_SIG_EXPIRE = 70001, // 登陆返回,票据过期
  103 +
  104 + ERR_SDK_HAD_INITIALIZED = 90001, // SDK 已经初始化无需重复初始化
  105 + ERR_OPENBDH_BASE = 115000, // openbdh 错误码基
  106 +};
  107 +
  108 +#endif /* TIMErrorCode_h */
  1 +//
  2 +// TIMFriendshipDefine.h
  3 +// imsdk
  4 +//
  5 +// Created by annidyfeng on 2019/3/7.
  6 +// Copyright © 2019年 Tencent. All rights reserved.
  7 +//
  8 +
  9 +#ifndef TIMFriendshipDefine_h
  10 +#define TIMFriendshipDefine_h
  11 +
  12 +#import "ImSDK.h"
  13 +
  14 +@class TIMFriendMetaInfo;
  15 +@class TIMFriendPendencyResponse;
  16 +@class TIMFriendPendencyItem;
  17 +@class TIMFriendFutureMeta;
  18 +@class TIMFriendGroup;
  19 +
  20 +#pragma mark - 枚举类型
  21 +
  22 +/**
  23 + * 好友操作状态
  24 + *
  25 + * 详细错误码参见 https://cloud.tencent.com/document/product/269/1671#.E5.85.B3.E7.B3.BB.E9.93.BE.E9.94.99.E8.AF.AF.E7.A0.81
  26 + */
  27 +typedef NS_ENUM(NSInteger, TIMFriendStatus) {
  28 + /**
  29 + * 操作成功
  30 + */
  31 + TIM_FRIEND_STATUS_SUCC = 0,
  32 +
  33 + /**
  34 + * 请求参数错误,请根据错误描述检查请求是否正确
  35 + */
  36 + TIM_FRIEND_PARAM_INVALID = 30001,
  37 +
  38 + /**
  39 + * 请求参数错误,SdkAppid 不匹配。
  40 + */
  41 + TIM_FRIEND_SDK_APPID_INVALID = 30002,
  42 +
  43 + /**
  44 + * 请求的用户帐号不存在
  45 + */
  46 + TIM_FRIEND_ID_INVALID = 30003,
  47 +
  48 + /**
  49 + * 请求需要 App 管理员权限
  50 + */
  51 + TIM_FRIEND_NEED_ADMIN_PERMISSON = 30004,
  52 +
  53 + /**
  54 + * 关系链字段中包含敏感词
  55 + */
  56 + TIM_FRIEND_DIRTY_WORD = 30005,
  57 +
  58 + /**
  59 + * 服务器内部错误,请重试
  60 + */
  61 + TIM_FRIEND_SERVER_ERROR = 30006,
  62 +
  63 + /**
  64 + * 网络超时,请稍后重试
  65 + */
  66 + TIM_FRIEND_TIMEOUT = 30007,
  67 +
  68 + /**
  69 + * 并发写导致写冲突,建议使用批量方式
  70 + */
  71 + TIM_FRIEND_WRITE_ERROR = 30008,
  72 +
  73 + /**
  74 + * 后台禁止该用户发起加好友请求
  75 + */
  76 + TIM_ADD_FRIEND_FORBIDEN = 30009,
  77 +
  78 + /**
  79 + * 自己的好友数已达系统上限
  80 + */
  81 + TIM_ADD_FRIEND_STATUS_SELF_FRIEND_FULL = 30010,
  82 +
  83 + /**
  84 + * 分组已达系统上限
  85 + */
  86 + TIM_UPDATE_FRIEND_GROUP_STATUS_MAX_GROUPS_EXCEED = 30011,
  87 +
  88 + /**
  89 + * 未决数已达系统上限。
  90 + */
  91 + TIM_PENDENCY_STATUS_FULL = 30012,
  92 +
  93 + /**
  94 + * 黑名单数已达系统上限
  95 + */
  96 + TIM_ADD_BLACKLIST_STATUS_FULL = 30013,
  97 +
  98 + /**
  99 + * 对方的好友数已达系统上限
  100 + */
  101 + TIM_ADD_FRIEND_STATUS_THEIR_FRIEND_FULL = 30014,
  102 +
  103 + /**
  104 + * 被加好友在自己的黑名单中
  105 + */
  106 + TIM_ADD_FRIEND_STATUS_IN_SELF_BLACK_LIST = 30515,
  107 +
  108 + /**
  109 + * 被加好友设置为禁止加好友
  110 + */
  111 + TIM_ADD_FRIEND_STATUS_FRIEND_SIDE_FORBID_ADD = 30516,
  112 +
  113 + /**
  114 + * 已被被添加好友设置为黑名单
  115 + */
  116 + TIM_ADD_FRIEND_STATUS_IN_OTHER_SIDE_BLACK_LIST = 30525,
  117 +
  118 + /**
  119 + * 等待好友审核同意
  120 + */
  121 + TIM_ADD_FRIEND_STATUS_PENDING = 30539,
  122 +
  123 + /**
  124 + * 添加好友请求被安全策略打击,请勿频繁发起添加好友请求
  125 + */
  126 + TIM_ADD_FRIEND_STATUS_SENSITIVE = 30540,
  127 +
  128 + /**
  129 + * 对方没有申请过好友
  130 + */
  131 + TIM_RESPONSE_FRIEND_STATUS_NO_REQ = 30614,
  132 +
  133 + /**
  134 + * 删除好友请求被安全策略打击,请勿频繁发起删除好友请求
  135 + */
  136 + TIM_DELETE_FRIEND_STATUS_SENSITIVE = 31707,
  137 +};
  138 +
  139 +typedef NS_ENUM(NSInteger, TIMDelFriendType) {
  140 + /**
  141 + * 删除单向好友
  142 + */
  143 + TIM_FRIEND_DEL_SINGLE = 1,
  144 +
  145 + /**
  146 + * 删除双向好友
  147 + */
  148 + TIM_FRIEND_DEL_BOTH = 2,
  149 +};
  150 +
  151 +typedef NS_ENUM(NSInteger, TIMPendencyType) {
  152 + /**
  153 + * 别人发给我的
  154 + */
  155 + TIM_PENDENCY_COME_IN = 1,
  156 +
  157 + /**
  158 + * 我发给别人的
  159 + */
  160 + TIM_PENDENCY_SEND_OUT = 2,
  161 +
  162 + /**
  163 + * 别人发给我的 和 我发给别人的。仅拉取时有效
  164 + */
  165 + TIM_PENDENCY_BOTH = 3,
  166 +};
  167 +
  168 +/**
  169 + * 推荐好友类型
  170 + */
  171 +typedef NS_ENUM(NSInteger, TIMFutureFriendType) {
  172 + /**
  173 + * 收到的未决请求
  174 + */
  175 + TIM_FUTURE_FRIEND_PENDENCY_IN_TYPE = 0x1,
  176 +
  177 + /**
  178 + * 发出去的未决请求
  179 + */
  180 + TIM_FUTURE_FRIEND_PENDENCY_OUT_TYPE = 0x2,
  181 +
  182 + /**
  183 + * 推荐好友
  184 + */
  185 + TIM_FUTURE_FRIEND_RECOMMEND_TYPE = 0x4,
  186 +
  187 + /**
  188 + * 已决好友
  189 + */
  190 + TIM_FUTURE_FRIEND_DECIDE_TYPE = 0x8,
  191 +};
  192 +
  193 +/**
  194 + * 翻页选项
  195 + */
  196 +typedef NS_ENUM(NSInteger, TIMPageDirectionType) {
  197 + /**
  198 + * 向上翻页
  199 + */
  200 + TIM_PAGE_DIRECTION_UP_TYPE = 1,
  201 +
  202 + /**
  203 + * 向下翻页
  204 + */
  205 + TIM_PAGE_DIRECTION_DOWN_TYPE = 2,
  206 +};
  207 +
  208 +/**
  209 + * 好友检查类型
  210 + */
  211 +typedef NS_ENUM(NSInteger,TIMFriendCheckType) {
  212 + /**
  213 + * 单向好友
  214 + */
  215 + TIM_FRIEND_CHECK_TYPE_UNIDIRECTION = 0x1,
  216 + /**
  217 + * 互为好友
  218 + */
  219 + TIM_FRIEND_CHECK_TYPE_BIDIRECTION = 0x2,
  220 +};
  221 +
  222 +/**
  223 + * 好友关系类型
  224 + */
  225 +typedef NS_ENUM(NSInteger,TIMFriendRelationType) {
  226 + /**
  227 + * 不是好友
  228 + */
  229 + TIM_FRIEND_RELATION_TYPE_NONE = 0x0,
  230 + /**
  231 + * 对方在我的好友列表中
  232 + */
  233 + TIM_FRIEND_RELATION_TYPE_MY_UNI = 0x1,
  234 + /**
  235 + * 我在对方的好友列表中
  236 + */
  237 + TIM_FRIEND_RELATION_TYPE_OTHER_UNI = 0x2,
  238 + /**
  239 + * 互为好友
  240 + */
  241 + TIM_FRIEND_RELATION_TYPE_BOTHWAY = 0x3,
  242 +};
  243 +
  244 +typedef NS_ENUM(NSInteger, TIMFriendResponseType) {
  245 + /**
  246 + * 同意加好友(建立单向好友)
  247 + */
  248 + TIM_FRIEND_RESPONSE_AGREE = 0,
  249 +
  250 + /**
  251 + * 同意加好友并加对方为好友(建立双向好友)
  252 + */
  253 + TIM_FRIEND_RESPONSE_AGREE_AND_ADD = 1,
  254 +
  255 + /**
  256 + * 拒绝对方好友请求
  257 + */
  258 + TIM_FRIEND_RESPONSE_REJECT = 2,
  259 +};
  260 +
  261 +#pragma mark - block回调
  262 +
  263 +/**
  264 + * 获取好友列表回调
  265 + *
  266 + * @param meta 好友元信息
  267 + * @param friends 好友列表 TIMUserProfile* 数组,只包含需要的字段
  268 + */
  269 +typedef void (^TIMGetFriendListByPageSucc)(TIMFriendMetaInfo * meta, NSArray * friends);
  270 +
  271 +/**
  272 + * 获取未决请求列表成功
  273 + *
  274 + * @param pendencyResponse 未决请求元信息
  275 + */
  276 +typedef void (^TIMGetFriendPendencyListSucc)(TIMFriendPendencyResponse *pendencyResponse);
  277 +
  278 +/**
  279 + * 群搜索回调
  280 + *
  281 + * @param totalNum 搜索结果的总数
  282 + * @param users 请求的用户列表片段
  283 + */
  284 +typedef void (^TIMUserSearchSucc)(uint64_t totalNum, NSArray * users);
  285 +
  286 +/**
  287 + * 好友分组列表
  288 + *
  289 + * @param groups 好友分组(TIMFriendGroup*)列表
  290 + */
  291 +typedef void (^TIMFriendGroupArraySucc)(NSArray<TIMFriendGroup *> * groups);
  292 +
  293 +/**
  294 + * 好友关系检查回调
  295 + *
  296 + * @param results TIMCheckFriendResult列表
  297 + */
  298 +typedef void (^TIMFriendCheckSucc)(NSArray* results);
  299 +
  300 +#pragma mark - 基本类型
  301 +
  302 +/**
  303 + * 加好友请求
  304 + */
  305 +@interface TIMFriendRequest : TIMCodingModel
  306 +
  307 +/**
  308 + * 用户identifier(必填)
  309 + */
  310 +@property (nonatomic,strong) NSString* identifier;
  311 +
  312 +/**
  313 + * 备注(备注最大96字节)
  314 + */
  315 +@property (nonatomic,strong) NSString* remark;
  316 +
  317 +/**
  318 + * 请求说明(最大120字节)
  319 + */
  320 +@property (nonatomic,strong) NSString* addWording;
  321 +
  322 +/**
  323 + * 添加来源
  324 + * 来源需要添加“AddSource_Type_”前缀
  325 + */
  326 +@property (nonatomic,strong) NSString* addSource;
  327 +
  328 +/**
  329 + * 分组
  330 + */
  331 +@property (nonatomic,strong) NSString* group;
  332 +
  333 +@end
  334 +
  335 +/**
  336 + * 未决请求
  337 + */
  338 +@interface TIMFriendPendencyItem : TIMCodingModel
  339 +
  340 +/**
  341 + * 用户标识
  342 + */
  343 +@property(nonatomic,strong) NSString* identifier;
  344 +/**
  345 + * 增加时间
  346 + */
  347 +@property(nonatomic,assign) uint64_t addTime;
  348 +/**
  349 + * 来源
  350 + */
  351 +@property(nonatomic,strong) NSString* addSource;
  352 +/**
  353 + * 加好友附言
  354 + */
  355 +@property(nonatomic,strong) NSString* addWording;
  356 +
  357 +/**
  358 + * 加好友昵称
  359 + */
  360 +@property(nonatomic,strong) NSString* nickname;
  361 +
  362 +/**
  363 + * 未决请求类型
  364 + */
  365 +@property(nonatomic,assign) TIMPendencyType type;
  366 +
  367 +@end
  368 +
  369 +/**
  370 + * 未决推送
  371 + */
  372 +@interface TIMFriendPendencyInfo : TIMCodingModel
  373 +/**
  374 + * 用户标识
  375 + */
  376 +@property(nonatomic,strong) NSString* identifier;
  377 +/**
  378 + * 来源
  379 + */
  380 +@property(nonatomic,strong) NSString* addSource;
  381 +/**
  382 + * 加好友附言
  383 + */
  384 +@property(nonatomic,strong) NSString* addWording;
  385 +
  386 +/**
  387 + * 加好友昵称
  388 + */
  389 +@property(nonatomic,strong) NSString* nickname;
  390 +@end
  391 +
  392 +/**
  393 + * 未决请求信息
  394 + */
  395 +@interface TIMFriendPendencyRequest : TIMCodingModel
  396 +
  397 +/**
  398 + * 序列号,未决列表序列号
  399 + * 建议客户端保存seq和未决列表,请求时填入server返回的seq
  400 + * 如果seq是server最新的,则不返回数据
  401 + */
  402 +@property(nonatomic,assign) uint64_t seq;
  403 +
  404 +/**
  405 + * 翻页时间戳,只用来翻页,server返回0时表示没有更多数据,第一次请求填0
  406 + * 特别注意的是,如果server返回的seq跟填入的seq不同,翻页过程中,需要使用客户端原始seq请求,直到数据请求完毕,才能更新本地seq
  407 + */
  408 +@property(nonatomic,assign) uint64_t timestamp;
  409 +
  410 +/**
  411 + * 每页的数量,即本次请求最多返回都个数据
  412 + */
  413 +@property(nonatomic,assign) uint64_t numPerPage;
  414 +
  415 +/**
  416 + * 未决请求拉取类型
  417 + */
  418 +@property(nonatomic,assign) TIMPendencyType type;
  419 +
  420 +@end
  421 +
  422 +/**
  423 + * 未决返回信息
  424 + */
  425 +@interface TIMFriendPendencyResponse : TIMCodingModel
  426 +
  427 +/**
  428 + * 本次请求的未决列表序列号
  429 + */
  430 +@property(nonatomic,assign) uint64_t seq;
  431 +
  432 +/**
  433 + * 本次请求的翻页时间戳
  434 + */
  435 +@property(nonatomic,assign) uint64_t timestamp;
  436 +
  437 +/**
  438 + * 未决请求未读数量
  439 + */
  440 +@property(nonatomic,assign) uint64_t unreadCnt;
  441 +
  442 +/**
  443 + * 未决数据
  444 + */
  445 +@property NSArray<TIMFriendPendencyItem *> * pendencies;
  446 +
  447 +@end
  448 +
  449 +
  450 +
  451 +/**
  452 + * 好友元信息
  453 + */
  454 +@interface TIMFriendMetaInfo : TIMCodingModel
  455 +
  456 +/**
  457 + * 时间戳,需要保存,下次拉取时传入,增量更新使用
  458 + */
  459 +@property(nonatomic,assign) uint64_t timestamp;
  460 +/**
  461 + * 序列号,需要保存,下次拉取时传入,增量更新使用
  462 + */
  463 +@property(nonatomic,assign) uint64_t infoSeq;
  464 +/**
  465 + * 分页信息,无需保存,返回为0时结束,非0时传入再次拉取,第一次拉取时传0
  466 + */
  467 +@property(nonatomic,assign) uint64_t nextSeq;
  468 +/**
  469 + * 覆盖:为TRUE时需要重设timestamp, infoSeq, nextSeq为0,清除客户端存储,重新拉取资料
  470 + */
  471 +@property(nonatomic,assign) BOOL recover;
  472 +
  473 +@end
  474 +
  475 +/**
  476 + * 好友分组信息
  477 + */
  478 +@interface TIMFriendGroup : TIMCodingModel
  479 +/**
  480 + * 好友分组名称
  481 + */
  482 +@property(nonatomic,strong) NSString* name;
  483 +
  484 +/**
  485 + * 分组成员数量
  486 + */
  487 +@property(nonatomic,assign) uint64_t userCnt;
  488 +
  489 +/**
  490 + * 分组成员identifier列表
  491 + */
  492 +@property(nonatomic,strong) NSArray* friends;
  493 +
  494 +@end
  495 +
  496 +/**
  497 + * 好友关系检查
  498 + */
  499 +@interface TIMFriendCheckInfo : NSObject
  500 +/**
  501 + * 检查用户的id列表(NSString*)
  502 + */
  503 +@property(nonatomic,strong) NSArray* users;
  504 +
  505 +/**
  506 + * 检查类型
  507 + */
  508 +@property(nonatomic,assign) TIMFriendCheckType checkType;
  509 +
  510 +@end
  511 +
  512 +@interface TIMCheckFriendResult : NSObject
  513 +/**
  514 + * 用户id
  515 + */
  516 +@property NSString* identifier;
  517 +
  518 +/**
  519 + * 返回码
  520 + */
  521 +@property NSInteger result_code;
  522 +
  523 +/**
  524 + * 返回信息
  525 + */
  526 +@property NSString *result_info;
  527 +
  528 +/**
  529 + * 检查结果
  530 + */
  531 +@property(nonatomic,assign) TIMFriendRelationType resultType;
  532 +
  533 +@end
  534 +
  535 +@interface TIMFriendResult : NSObject
  536 +
  537 +/**
  538 + * 用户Id
  539 + */
  540 +@property NSString* identifier;
  541 +
  542 +/**
  543 + * 返回码
  544 + */
  545 +@property NSInteger result_code;
  546 +
  547 +/**
  548 + * 返回信息
  549 + */
  550 +@property NSString *result_info;
  551 +
  552 +@end
  553 +
  554 +/**
  555 + * 响应好友请求
  556 + */
  557 +@interface TIMFriendResponse : NSObject
  558 +
  559 +/**
  560 + * 响应类型
  561 + */
  562 +@property(nonatomic,assign) TIMFriendResponseType responseType;
  563 +
  564 +/**
  565 + * 用户identifier
  566 + */
  567 +@property(nonatomic,strong) NSString* identifier;
  568 +
  569 +/**
  570 + * 备注好友(可选,如果要加对方为好友)。备注最大96字节
  571 + */
  572 +@property(nonatomic,strong) NSString* remark;
  573 +
  574 +@end
  575 +
  576 +
  577 +/**
  578 + * 好友分组信息扩展
  579 + */
  580 +@interface TIMFriendGroupWithProfiles : TIMFriendGroup
  581 +/**
  582 + * 好友资料(TIMUserProfile*)列表
  583 + */
  584 +@property(nonatomic,strong) NSArray* profiles;
  585 +@end
  586 +
  587 +// 用户资料KEY
  588 +
  589 +/**
  590 + * 昵称
  591 + * 值类型: NSString
  592 + */
  593 +extern NSString *const TIMProfileTypeKey_Nick;
  594 +/**
  595 + * 头像
  596 + * 值类型: NSString
  597 + */
  598 +extern NSString *const TIMProfileTypeKey_FaceUrl;
  599 +/**
  600 + * 好友申请
  601 + * 值类型: NSNumber [TIM_FRIEND_ALLOW_ANY,TIM_FRIEND_NEED_CONFIRM,TIM_FRIEND_DENY_ANY]
  602 + */
  603 +extern NSString *const TIMProfileTypeKey_AllowType;
  604 +/**
  605 + * 性别
  606 + * 值类型: NSNumber [TIM_GENDER_UNKNOWN,TIM_GENDER_MALE,TIM_GENDER_FEMALE]
  607 + */
  608 +extern NSString *const TIMProfileTypeKey_Gender;
  609 +/**
  610 + * 生日
  611 + * 值类型: NSNumber
  612 + */
  613 +extern NSString *const TIMProfileTypeKey_Birthday;
  614 +/**
  615 + * 位置
  616 + * 值类型: NSString
  617 + */
  618 +extern NSString *const TIMProfileTypeKey_Location;
  619 +/**
  620 + * 语言
  621 + * 值类型: NSNumber
  622 + */
  623 +extern NSString *const TIMProfileTypeKey_Language;
  624 +/**
  625 + * 等级
  626 + * 值类型: NSNumber
  627 + */
  628 +extern NSString *const TIMProfileTypeKey_Level;
  629 +/**
  630 + * 角色
  631 + * 值类型: NSNumber
  632 + */
  633 +extern NSString *const TIMProfileTypeKey_Role;
  634 +/**
  635 + * 签名
  636 + * 值类型: NSString
  637 + */
  638 +extern NSString *const TIMProfileTypeKey_SelfSignature;
  639 +/**
  640 + * 自定义字段前缀
  641 + * 值类型: [NSString,NSData|NSNumber]
  642 + * @note 当设置自定义字的值NSString对象时,后台会将其转为UTF8保存在数据库中。由于部分用户迁移资料时可能不是UTF8类型,所以在获取资料时,统一返回NSData类型。
  643 + */
  644 +extern NSString *const TIMProfileTypeKey_Custom_Prefix;
  645 +
  646 +// 好友资料KEY
  647 +
  648 +/**
  649 + * 备注
  650 + * 值类型: NSString
  651 + */
  652 +extern NSString *const TIMFriendTypeKey_Remark;
  653 +/**
  654 + * 分组
  655 + * 值类型: [NSArray]
  656 + */
  657 +extern NSString *const TIMFriendTypeKey_Group;
  658 +/**
  659 + * 自定义字段前缀
  660 + * 值类型: [NSString,NSData|NSNumber]
  661 + */
  662 +extern NSString *const TIMFriendTypeKey_Custom_Prefix;
  663 +#endif /* TIMFriendshipDefine_h */
  664 +
  1 +//
  2 +// TIMFriendshipManager.h
  3 +// imsdk
  4 +//
  5 +// Created by annidyfeng on 2019/3/7.
  6 +// Copyright © 2019年 Tencent. All rights reserved.
  7 +//
  8 +
  9 +#ifndef TIMFriendshipManager_h
  10 +#define TIMFriendshipManager_h
  11 +
  12 +#import "TIMComm.h"
  13 +#import "TIMFriendshipDefine.h"
  14 +
  15 +@interface TIMFriendshipManager : NSObject
  16 +/**
  17 + * 获取好友管理器实例
  18 + *
  19 + * @return 管理器实例
  20 + */
  21 ++ (TIMFriendshipManager*)sharedInstance;
  22 +
  23 +/**
  24 + * 设置自己的资料
  25 + *
  26 + * @param values 需要更新的属性,可一次更新多个字段. 参见 TIMFriendshipDefine.h 的 TIMProfileTypeKey_XXX
  27 + * @param succ 成功回调
  28 + * @param fail 失败回调
  29 + *
  30 + * @return 0 发送请求成功
  31 + */
  32 +- (int)modifySelfProfile:(NSDictionary<NSString *, id> *)values succ:(TIMSucc)succ fail:(TIMFail)fail;
  33 +
  34 +/**
  35 + * 获取自己的资料
  36 + *
  37 + * @param succ 成功回调,返回 TIMUserProfile
  38 + * @param fail 失败回调
  39 + *
  40 + * @return 0 发送请求成功
  41 + */
  42 +- (int)getSelfProfile:(TIMGetProfileSucc)succ fail:(TIMFail)fail;
  43 +
  44 +/**
  45 + * 在缓存中查询自己的资料
  46 + *
  47 + * @return 返回缓存的资料,未找到返回nil
  48 + */
  49 +- (TIMUserProfile *)querySelfProfile;
  50 +
  51 +/**
  52 + * 获取指定用户资料
  53 + *
  54 + * @param identifiers 用户id,非好友的用户也可以
  55 + * @prarm forceUpdate 强制从后台拉取
  56 + * @param succ 成功回调
  57 + * @param fail 失败回调
  58 + *
  59 + * @return 0 发送请求成功
  60 + */
  61 +- (int)getUsersProfile:(NSArray<NSString *> *)identifiers forceUpdate:(BOOL)forceUpdate succ:(TIMUserProfileArraySucc)succ fail:(TIMFail)fail;
  62 +
  63 +/**
  64 + * 在缓存中查询用户的资料
  65 + *
  66 + * @praram identifier 用户id,非好友的用户也可以
  67 + *
  68 + * @return 返回缓存的资料,未找到返回nil
  69 + */
  70 +- (TIMUserProfile *)queryUserProfile:(NSString *)identifier;
  71 +
  72 +/**
  73 + * 获取好友列表
  74 + *
  75 + * @param succ 成功回调,返回好友(TIMFriend)列表
  76 + * @param fail 失败回调
  77 + *
  78 + * @return 0 发送请求成功
  79 + */
  80 +-(int)getFriendList:(TIMFriendArraySucc)succ fail:(TIMFail)fail;
  81 +
  82 +
  83 +/**
  84 + * 在缓存中查询用户的关系链数据
  85 + *
  86 + * @praram identifier 用户id
  87 + *
  88 + * @return 返回缓存的关系链数据,未找到返回nil
  89 + * @note 缓存数据来自于上一次调用getFriendList,请确保已调用了获取好友列表方法
  90 + */
  91 +- (TIMFriend *)queryFriend:(NSString *)identifier;
  92 +
  93 +/**
  94 + * 获取缓存中的关系链列表
  95 + *
  96 + * @return 返回缓存的关系链数据
  97 + * @note 缓存数据来自于上一次调用getFriendList,请确保已调用了获取好友列表方法
  98 + */
  99 +- (NSArray<TIMFriend *> *)queryFriendList;
  100 +
  101 +/**
  102 + * 检查指定用户的好友关系
  103 + *
  104 + * @param checkInfo 好友检查信息
  105 + * @param succ 成功回调,返回检查结果
  106 + * @param fail 失败回调
  107 + *
  108 + * @return 0 发送成功
  109 + */
  110 +- (int)checkFriends:(TIMFriendCheckInfo *)checkInfo succ:(TIMCheckFriendResultArraySucc)succ fail:(TIMFail)fail;
  111 +
  112 +/**
  113 + * 添加好友
  114 + *
  115 + * @param request 添加好友请求
  116 + * @param succ 成功回调(TIMFriendResult)
  117 + * @param fail 失败回调
  118 + *
  119 + * @return 0 发送请求成功
  120 + */
  121 +- (int)addFriend:(TIMFriendRequest *)request succ:(TIMFriendResultSucc)succ fail:(TIMFail)fail;
  122 +
  123 +/**
  124 + * 响应对方好友邀请
  125 + *
  126 + * @param response 响应请求
  127 + * @param succ 成功回调
  128 + * @param fail 失败回调
  129 + *
  130 + * @return 0 发送请求成功
  131 + */
  132 +- (int)doResponse:(TIMFriendResponse *)response succ:(TIMFriendResultSucc)succ fail:(TIMFail)fail;
  133 +
  134 +/**
  135 + * 删除好友
  136 + *
  137 + * @param identifiers 好友id
  138 + * @param delType 删除类型(单向好友、双向好友)
  139 + * @param succ 成功回调([TIMFriendResult])
  140 + * @param fail 失败回调
  141 + *
  142 + * @return 0 发送请求成功
  143 + */
  144 +- (int)deleteFriends:(NSArray *)identifiers delType:(TIMDelFriendType)delType succ:(TIMFriendResultArraySucc)succ fail:(TIMFail)fail;
  145 +
  146 +/**
  147 + * 修改好友
  148 + *
  149 + * @param identifier 好友id
  150 + * @param values 需要更新的属性,可一次更新多个字段. 参见 TIMFriendshipDefine.h 的 TIMFriendTypeKey_XXX
  151 + * @param succ 成功回调
  152 + * @param fail 失败回调
  153 + *
  154 + * @return 0 发送请求成功
  155 + */
  156 +- (int)modifyFriend:(NSString *)identifier values:(NSDictionary<NSString *, id> *)values succ:(TIMSucc)succ fail:(TIMFail)fail;
  157 +
  158 +/**
  159 + * 获取未决列表
  160 + *
  161 + * @param pendencyRequest 请求信息,详细参考TIMFriendPendencyRequest
  162 + * @param succ 成功回调
  163 + * @param fail 失败回调
  164 + *
  165 + * @return 0 发送请求成功
  166 + */
  167 +- (int)getPendencyList:(TIMFriendPendencyRequest *)pendencyRequest succ:(TIMGetFriendPendencyListSucc)succ fail:(TIMFail)fail;
  168 +
  169 +/**
  170 + * 未决删除
  171 + *
  172 + * @param type 未决好友类型
  173 + * @param identifiers 要删除的未决列表
  174 + * @param succ 成功回调
  175 + * @param fail 失败回调
  176 + *
  177 + * @return 0 发送请求成功
  178 + */
  179 +- (int)deletePendency:(TIMPendencyType)type users:(NSArray *)identifiers succ:(TIMSucc)succ fail:(TIMFail)fail;
  180 +
  181 +/**
  182 + * 未决已读上报
  183 + *
  184 + * @param timestamp 已读时间戳,此时间戳以前的消息都将置为已读
  185 + * @param succ 成功回调
  186 + * @param fail 失败回调
  187 + *
  188 + * @return 0 发送请求成功
  189 + */
  190 +- (int)pendencyReport:(uint64_t)timestamp succ:(TIMSucc)succ fail:(TIMFail)fail;
  191 +
  192 +/**
  193 + * 获取黑名单列表
  194 + *
  195 + * @param succ 成功回调,返回NSString*列表
  196 + * @param fail 失败回调
  197 + *
  198 + * @return 0 发送请求成功
  199 + */
  200 +- (int)getBlackList:(TIMFriendArraySucc)succ fail:(TIMFail)fail;
  201 +
  202 +/**
  203 + * 添加用户到黑名单
  204 + *
  205 + * @param identifiers 用户列表
  206 + * @param succ 成功回调
  207 + * @param fail 失败回调
  208 + *
  209 + * @return 0 发送请求成功
  210 + */
  211 +- (int)addBlackList:(NSArray *)identifiers succ:(TIMFriendResultArraySucc)succ fail:(TIMFail)fail;
  212 +
  213 +/**
  214 + * 把用户从黑名单中删除
  215 + *
  216 + * @param identifiers 用户列表
  217 + * @param succ 成功回调
  218 + * @param fail 失败回调
  219 + *
  220 + * @return 0 发送请求成功
  221 + */
  222 +- (int)deleteBlackList:(NSArray *)identifiers succ:(TIMFriendResultArraySucc)succ fail:(TIMFail)fail;
  223 +
  224 +/**
  225 + * 新建好友分组
  226 + *
  227 + * @param groupNames 分组名称列表,必须是当前不存在的分组
  228 + * @param identifiers 要添加到分组中的好友
  229 + * @param succ 成功回调
  230 + * @param fail 失败回调
  231 + *
  232 + * @return 0 发送请求成功
  233 + */
  234 +- (int)createFriendGroup:(NSArray *)groupNames users:(NSArray *)identifiers succ:(TIMFriendResultArraySucc)succ fail:(TIMFail)fail;
  235 +
  236 +/**
  237 + * 获取指定的好友分组信息
  238 + *
  239 + * @param groupNames 要获取信息的好友分组名称列表,传入nil获得所有分组信息
  240 + * @param succ 成功回调,返回 TIMFriendGroup* 列表
  241 + * @param fail 失败回调
  242 + *
  243 + * @return 0 发送请求成功
  244 + */
  245 +- (int)getFriendGroups:(NSArray *)groupNames succ:(TIMFriendGroupArraySucc)succ fail:(TIMFail)fail;
  246 +
  247 +/**
  248 + * 删除好友分组
  249 + *
  250 + * @param groupNames 要删除的好友分组名称列表
  251 + * @param succ 成功回调
  252 + * @param fail 失败回调
  253 + *
  254 + * @return 0 发送请求成功
  255 + */
  256 +- (int)deleteFriendGroup:(NSArray *)groupNames succ:(TIMSucc)succ fail:(TIMFail)fail;
  257 +
  258 +/**
  259 + * 修改好友分组的名称
  260 + *
  261 + * @param oldName 原来的分组名称
  262 + * @param newName 新的分组名称
  263 + * @param succ 成功回调
  264 + * @param fail 失败回调
  265 + *
  266 + * @return 0 发送请求成功
  267 + */
  268 +- (int)renameFriendGroup:(NSString*)oldName newName:(NSString*)newName succ:(TIMSucc)succ fail:(TIMFail)fail;
  269 +
  270 +/**
  271 + * 添加好友到一个好友分组
  272 + *
  273 + * @param groupName 好友分组名称
  274 + * @param identifiers 要添加到分组中的好友
  275 + * @param succ 成功回调
  276 + * @param fail 失败回调
  277 + *
  278 + * @return 0 发送请求成功
  279 + */
  280 +- (int)addFriendsToFriendGroup:(NSString *)groupName users:(NSArray *)identifiers succ:(TIMFriendResultArraySucc)succ fail:(TIMFail)fail;
  281 +
  282 +/**
  283 + * 从好友分组中删除好友
  284 + *
  285 + * @param groupName 好友分组名称
  286 + * @param identifiers 要移出分组的好友
  287 + * @param succ 成功回调
  288 + * @param fail 失败回调
  289 + *
  290 + * @return 0 发送请求成功
  291 + */
  292 +- (int)deleteFriendsFromFriendGroup:(NSString *)groupName users:(NSArray *)identifiers succ:(TIMFriendResultArraySucc)succ fail:(TIMFail)fail;
  293 +@end
  294 +
  295 +#endif /* TIMFriendshipManager_h */
@@ -9,7 +9,7 @@ @@ -9,7 +9,7 @@
9 #ifndef TIMGroupManager_Ext_h 9 #ifndef TIMGroupManager_Ext_h
10 #define TIMGroupManager_Ext_h 10 #define TIMGroupManager_Ext_h
11 11
12 -#import "ImSDK.h" 12 +#import "TIMGroupManager.h"
13 #import "TIMComm+Group.h" 13 #import "TIMComm+Group.h"
14 14
15 @interface TIMGroupManager (Ext) 15 @interface TIMGroupManager (Ext)
@@ -17,124 +17,154 @@ @@ -17,124 +17,154 @@
17 /** 17 /**
18 * 创建私有群 18 * 创建私有群
19 * 19 *
  20 + * 创建者默认加入群组,无需显式指定,群组类型形态请参考官网文档 [群组形态介绍](https://cloud.tencent.com/document/product/269/1502#.E7.BE.A4.E7.BB.84.E5.BD.A2.E6.80.81.E4.BB.8B.E7.BB.8D)
  21 + *
20 * @param members 群成员,NSString* 数组 22 * @param members 群成员,NSString* 数组
21 * @param groupName 群名 23 * @param groupName 群名
22 - * @param succ 成功回调 24 + * @param succ 成功回调 groupId
23 * @param fail 失败回调 25 * @param fail 失败回调
24 * 26 *
25 - * @return 0 成功 27 + * @return 0:成功;1:失败
26 */ 28 */
27 - (int)createPrivateGroup:(NSArray*)members groupName:(NSString*)groupName succ:(TIMCreateGroupSucc)succ fail:(TIMFail)fail; 29 - (int)createPrivateGroup:(NSArray*)members groupName:(NSString*)groupName succ:(TIMCreateGroupSucc)succ fail:(TIMFail)fail;
28 30
29 /** 31 /**
30 * 创建公开群 32 * 创建公开群
31 * 33 *
  34 + * 创建者默认加入群组,无需显式指定,群组类型形态请参考官网文档 [群组形态介绍](https://cloud.tencent.com/document/product/269/1502#.E7.BE.A4.E7.BB.84.E5.BD.A2.E6.80.81.E4.BB.8B.E7.BB.8D)
  35 + *get
32 * @param members 群成员,NSString* 数组 36 * @param members 群成员,NSString* 数组
33 * @param groupName 群名 37 * @param groupName 群名
34 - * @param succ 成功回调 38 + * @param succ 成功回调 groupId
35 * @param fail 失败回调 39 * @param fail 失败回调
36 * 40 *
37 - * @return 0 成功 41 + * @return 0:成功;1:失败
38 */ 42 */
39 - (int)createPublicGroup:(NSArray*)members groupName:(NSString*)groupName succ:(TIMCreateGroupSucc)succ fail:(TIMFail)fail; 43 - (int)createPublicGroup:(NSArray*)members groupName:(NSString*)groupName succ:(TIMCreateGroupSucc)succ fail:(TIMFail)fail;
40 44
41 /** 45 /**
42 * 创建聊天室 46 * 创建聊天室
43 * 47 *
  48 + * 创建者默认加入群组,无需显式指定,群组类型形态请参考官网文档 [群组形态介绍](https://cloud.tencent.com/document/product/269/1502#.E7.BE.A4.E7.BB.84.E5.BD.A2.E6.80.81.E4.BB.8B.E7.BB.8D)
  49 + *
44 * @param members 群成员,NSString* 数组 50 * @param members 群成员,NSString* 数组
45 * @param groupName 群名 51 * @param groupName 群名
46 - * @param succ 成功回调 52 + * @param succ 成功回调 groupId
47 * @param fail 失败回调 53 * @param fail 失败回调
48 * 54 *
49 - * @return 0 成功 55 + * @return 0:成功;1:失败
50 */ 56 */
51 - (int)createChatRoomGroup:(NSArray*)members groupName:(NSString*)groupName succ:(TIMCreateGroupSucc)succ fail:(TIMFail)fail; 57 - (int)createChatRoomGroup:(NSArray*)members groupName:(NSString*)groupName succ:(TIMCreateGroupSucc)succ fail:(TIMFail)fail;
52 58
53 /** 59 /**
54 * 创建音视频聊天室(可支持超大群,详情可参考wiki文档) 60 * 创建音视频聊天室(可支持超大群,详情可参考wiki文档)
55 * 61 *
  62 + * 创建者默认加入群组,无需显式指定,群组类型形态请参考官网文档 [群组形态介绍](https://cloud.tencent.com/document/product/269/1502#.E7.BE.A4.E7.BB.84.E5.BD.A2.E6.80.81.E4.BB.8B.E7.BB.8D)
  63 + *
56 * @param groupName 群名 64 * @param groupName 群名
57 - * @param succ 成功回调 65 + * @param succ 成功回调 groupId
58 * @param fail 失败回调 66 * @param fail 失败回调
59 * 67 *
60 - * @return 0 成功 68 + * @return 0:成功;1:失败
61 */ 69 */
62 - (int)createAVChatRoomGroup:(NSString*)groupName succ:(TIMCreateGroupSucc)succ fail:(TIMFail)fail; 70 - (int)createAVChatRoomGroup:(NSString*)groupName succ:(TIMCreateGroupSucc)succ fail:(TIMFail)fail;
63 71
64 /** 72 /**
65 - * 创建群组 73 + * 创建自定义群组
66 * 74 *
67 - * @param groupInfo 群组信息  
68 - * @param succ 成功回调 75 + * 在创建群组时,除了设置默认的成员以及群名外,还可以设置如群公告、群简介等字段。
  76 + *
  77 + * @param groupInfo 群组信息,详情请参考 TIMComm+Group.h 里面的 TIMCreateGroupInfo 定义
  78 + * @param succ 成功回调 groupId
69 * @param fail 失败回调 79 * @param fail 失败回调
70 * 80 *
71 - * @return 0 成功 81 + * @return 0:成功;1:失败
72 */ 82 */
73 - (int)createGroup:(TIMCreateGroupInfo*)groupInfo succ:(TIMCreateGroupSucc)succ fail:(TIMFail)fail; 83 - (int)createGroup:(TIMCreateGroupInfo*)groupInfo succ:(TIMCreateGroupSucc)succ fail:(TIMFail)fail;
74 84
75 /** 85 /**
76 * 邀请好友入群 86 * 邀请好友入群
77 * 87 *
  88 + * 1. 只有私有群可以拉用户入群。
  89 + * 2. 直播大群:不能邀请用户入群。
  90 + * 3. 不允许群成员邀请他人入群,但创建群时可以直接拉人入群。
  91 + *
78 * @param group 群组Id 92 * @param group 群组Id
79 * @param members 要加入的成员列表(NSString* 类型数组) 93 * @param members 要加入的成员列表(NSString* 类型数组)
80 - * @param succ 成功回调 94 + * @param succ 成功回调 (TIMGroupMemberResult 列表)
81 * @param fail 失败回调 95 * @param fail 失败回调
82 * 96 *
83 - * @return 0 成功 97 + * @return 0:成功;1:失败
84 */ 98 */
85 - (int)inviteGroupMember:(NSString*)group members:(NSArray*)members succ:(TIMGroupMemberSucc)succ fail:(TIMFail)fail; 99 - (int)inviteGroupMember:(NSString*)group members:(NSArray*)members succ:(TIMGroupMemberSucc)succ fail:(TIMFail)fail;
86 100
87 /** 101 /**
88 * 删除群成员 102 * 删除群成员
89 * 103 *
  104 + * 1. 私有群:只有创建者可删除群组成员。
  105 + * 2. 公开群、聊天室:只有管理员和群主可以踢人。
  106 + * 3. 对于直播大群:不能踢人。
  107 + *
90 * @param group 群组Id 108 * @param group 群组Id
91 * @param reason 删除原因 109 * @param reason 删除原因
92 * @param members 要删除的成员列表 110 * @param members 要删除的成员列表
93 - * @param succ 成功回调 111 + * @param succ 成功回调 (TIMGroupMemberResult 列表)
94 * @param fail 失败回调 112 * @param fail 失败回调
95 * 113 *
96 - * @return 0 成功 114 + * @return 0:成功;1:失败
97 */ 115 */
98 - (int)deleteGroupMemberWithReason:(NSString*)group reason:(NSString*)reason members:(NSArray*)members succ:(TIMGroupMemberSucc)succ fail:(TIMFail)fail; 116 - (int)deleteGroupMemberWithReason:(NSString*)group reason:(NSString*)reason members:(NSArray*)members succ:(TIMGroupMemberSucc)succ fail:(TIMFail)fail;
99 117
100 -/**  
101 - * 获取群公开信息  
102 - * @param groups 群组Id  
103 - * @param succ 成功回调  
104 - * @param fail 失败回调  
105 - *  
106 - * @return 0 成功  
107 - */  
108 -- (int)getGroupPublicInfo:(NSArray*)groups succ:(TIMGroupListSucc)succ fail:(TIMFail)fail;  
109 118
110 /** 119 /**
111 * 获取群列表 120 * 获取群列表
112 * 121 *
113 - * @param succ 成功回调,NSArray列表为 TIMGroupInfo,结构体只包含 group\groupName\groupType\faceUrl\allShutup\selfInfo 信息 122 + * 1. 可以获取自己所加入的群列表。
  123 + * 2. 只能获得加入的部分直播大群的列表。
  124 + *
  125 + * @param succ 成功回调,NSArray 列表为 TIMGroupInfo,结构体只包含 group\groupName\groupType\faceUrl\allShutup\selfInfo 信息
114 * @param fail 失败回调 126 * @param fail 失败回调
115 * 127 *
116 - * @return 0 成功 128 + * @return 0:成功;1:失败
117 */ 129 */
118 - (int)getGroupList:(TIMGroupListSucc)succ fail:(TIMFail)fail; 130 - (int)getGroupList:(TIMGroupListSucc)succ fail:(TIMFail)fail;
119 131
120 /** 132 /**
121 - * 获取群信息 133 + * 获取服务器存储的群组信息
  134 + *
  135 + * 1. 无论是公开群还是私有群,群成员均可以拉到群组信息。
  136 + * 2. 如果是公开群,非群组成员可以拉到 group\groupName\owner\groupType\createTime\maxMemberNum\memberNum\introduction\faceURL\addOpt\onlineMemberNum\customInfo 这些字段信息。如果是私有群,非群组成员拉取不到群组信息。
  137 + * 3. 群成员和非群成员这个接口都拉取不到 selfInfo 信息。
  138 + * 4. 默认拉取基本资料,如果想要拉取自定义字段,首先要通过 [IM 控制台](https://console.cloud.tencent.com/avc) -> 功能配置 -> 群维度自定义字段 配置相关的 key 和权限,然后在 initSDK 的时候把生成的 key 设置在 IMGroupInfoOption 里面的 groupCustom 字段。需要注意的是,只有对自定义字段的 value 做了赋值或则修改,才能拉取到自定义字段。
122 * 139 *
123 - * @param succ 成功回调,不包含 selfInfo信息 140 + * @param succ 成功回调,不包含 selfInfo 信息
124 * @param fail 失败回调 141 * @param fail 失败回调
125 * 142 *
126 - * @return 0 成功 143 + * @return 0:成功;1:失败
127 */ 144 */
128 - (int)getGroupInfo:(NSArray*)groups succ:(TIMGroupListSucc)succ fail:(TIMFail)fail; 145 - (int)getGroupInfo:(NSArray*)groups succ:(TIMGroupListSucc)succ fail:(TIMFail)fail;
129 146
130 /** 147 /**
  148 + * 获取本地存储的群组信息
  149 + *
  150 + * 1. 无论是公开群还是私有群,群成员均可以拉到群组信息。
  151 + * 2. 如果是公开群,非群组成员可以拉到 group\groupName\owner\groupType\createTime\maxMemberNum\memberNum\introduction\faceURL\addOpt\onlineMemberNum\customInfo 这些字段信息。如果是私有群,非群组成员拉取不到群组信息。
  152 + * 3. 群成员和非群成员这个接口都拉取不到 selfInfo 信息。
  153 + *
  154 + * @return 群组信息
  155 + */
  156 +- (TIMGroupInfo *)queryGroupInfo:(NSString *)group;
  157 +
  158 +/**
131 * 获取本人在群组内的成员信息 159 * 获取本人在群组内的成员信息
132 * 160 *
  161 + * 默认拉取基本资料,如果想要拉取自定义字段,请参考 getGroupInfo
  162 + *
133 * @param group 群组Id 163 * @param group 群组Id
134 * @param succ 成功回调,返回信息 164 * @param succ 成功回调,返回信息
135 * @param fail 失败回调 165 * @param fail 失败回调
136 * 166 *
137 - * @return 0 成功 167 + * @return 0:成功;1:失败
138 */ 168 */
139 - (int)getGroupSelfInfo:(NSString*)group succ:(TIMGroupSelfSucc)succ fail:(TIMFail)fail; 169 - (int)getGroupSelfInfo:(NSString*)group succ:(TIMGroupSelfSucc)succ fail:(TIMFail)fail;
140 170
@@ -142,33 +172,39 @@ @@ -142,33 +172,39 @@
142 * 获取接受消息选项 172 * 获取接受消息选项
143 * 173 *
144 * @param group 群组Id 174 * @param group 群组Id
145 - * @param succ 成功回调 175 + * @param succ 成功回调, TIMGroupReceiveMessageOpt 0:接收消息;1:不接收消息,服务器不进行转发;2:接受消息,不进行 iOS APNs 推送
146 * @param fail 失败回调 176 * @param fail 失败回调
147 * 177 *
148 - * @return 0 成功 178 + * @return 0:成功;1:失败
149 */ 179 */
150 - (int)getReciveMessageOpt:(NSString*)group succ:(TIMGroupReciveMessageOptSucc)succ fail:(TIMFail)fail; 180 - (int)getReciveMessageOpt:(NSString*)group succ:(TIMGroupReciveMessageOptSucc)succ fail:(TIMFail)fail;
151 181
152 /** 182 /**
153 * 获取群成员列表 183 * 获取群成员列表
154 * 184 *
  185 + * 1. 获取群内成员列表,默认拉取内置字段,但不拉取自定义字段,如果想要拉取自定义字段,首先要通过 [IM 控制台](https://console.cloud.tencent.com/avc) -> 功能配置 -> 群维度自定义字段 配置相关的 key 和权限,然后在 initSDK 的时候把生成的 key 设置在 IMGroupInfoOption 里面的 groupCustom 字段。需要注意的是,只有对自定义字段的 value 做了赋值或则修改,才能拉取到自定义字段。
  186 + * 2. 任何群组类型:都可以获取成员列表。
  187 + * 3. 直播大群:只能拉取部分成员(包括群主、管理员和部分成员)。
  188 + *
155 * @param group 群组Id 189 * @param group 群组Id
156 - * @param succ 成功回调(TIMGroupMemberInfo列表) 190 + * @param succ 成功回调 (TIMGroupMemberInfo 列表)
157 * @param fail 失败回调 191 * @param fail 失败回调
158 * 192 *
159 - * @return 0 成功 193 + * @return 0:成功;1:失败
160 */ 194 */
161 - (int)getGroupMembers:(NSString*)group succ:(TIMGroupMemberSucc)succ fail:(TIMFail)fail; 195 - (int)getGroupMembers:(NSString*)group succ:(TIMGroupMemberSucc)succ fail:(TIMFail)fail;
162 196
163 /** 197 /**
164 * 获取群组指定成员的信息 198 * 获取群组指定成员的信息
165 * 199 *
  200 + * 获取群组指定成员的信息,需要设置群成员 members,其他限制参考 getGroupMembers
  201 + *
166 * @param group 群组Id 202 * @param group 群组Id
167 * @param members 成员Id(NSString*)列表 203 * @param members 成员Id(NSString*)列表
168 - * @param succ 成功回调(TIMGroupMemberInfo列表) 204 + * @param succ 成功回调 (TIMGroupMemberInfo 列表)
169 * @param fail 失败回调 205 * @param fail 失败回调
170 * 206 *
171 - * @return 0 成功 207 + * @return 0:成功;1:失败
172 */ 208 */
173 - (int)getGroupMembersInfo:(NSString*)group members:(NSArray*)members succ:(TIMGroupMemberSucc)succ fail:(TIMFail)fail; 209 - (int)getGroupMembersInfo:(NSString*)group members:(NSArray*)members succ:(TIMGroupMemberSucc)succ fail:(TIMFail)fail;
174 210
@@ -179,123 +215,151 @@ @@ -179,123 +215,151 @@
179 * @param filter 群成员角色过滤方式 215 * @param filter 群成员角色过滤方式
180 * @param flags 拉取资料标志 216 * @param flags 拉取资料标志
181 * @param custom 要获取的自定义key(NSString*)列表 217 * @param custom 要获取的自定义key(NSString*)列表
182 - * @param nextSeq 分页拉取标志,第一次拉取填0,回调成功如果不为零,需要分页,传入再次拉取,直至为0 218 + * @param nextSeq 分页拉取标志,第一次拉取填0,回调成功如果 nextSeq 不为零,需要分页,传入再次拉取,直至为0
183 * @param succ 成功回调 219 * @param succ 成功回调
184 * @param fail 失败回调 220 * @param fail 失败回调
  221 + * @return 0:成功;1:失败
185 */ 222 */
186 - (int)getGroupMembers:(NSString*)group ByFilter:(TIMGroupMemberFilter)filter flags:(TIMGetGroupMemInfoFlag)flags custom:(NSArray*)custom nextSeq:(uint64_t)nextSeq succ:(TIMGroupMemberSuccV2)succ fail:(TIMFail)fail; 223 - (int)getGroupMembers:(NSString*)group ByFilter:(TIMGroupMemberFilter)filter flags:(TIMGetGroupMemInfoFlag)flags custom:(NSArray*)custom nextSeq:(uint64_t)nextSeq succ:(TIMGroupMemberSuccV2)succ fail:(TIMFail)fail;
187 224
188 /** 225 /**
189 * 修改群名 226 * 修改群名
190 * 227 *
  228 + * 1. 公开群、聊天室和直播大群:只有群主或者管理员可以修改群名。
  229 + * 2. 私有群:任何人可修改群名。
  230 + *
191 * @param group 群组Id 231 * @param group 群组Id
192 * @param groupName 新群名 232 * @param groupName 新群名
193 * @param succ 成功回调 233 * @param succ 成功回调
194 * @param fail 失败回调 234 * @param fail 失败回调
195 * 235 *
196 - * @return 0 成功 236 + * @return 0:成功;1:失败
197 */ 237 */
198 - (int)modifyGroupName:(NSString*)group groupName:(NSString*)groupName succ:(TIMSucc)succ fail:(TIMFail)fail; 238 - (int)modifyGroupName:(NSString*)group groupName:(NSString*)groupName succ:(TIMSucc)succ fail:(TIMFail)fail;
199 239
200 /** 240 /**
201 * 修改群简介 241 * 修改群简介
202 * 242 *
  243 + * 1. 公开群、聊天室、直播大群:只有群主或者管理员可以修改群简介。
  244 + * 2. 私有群:任何人可修改群简介。
  245 + *
203 * @param group 群组Id 246 * @param group 群组Id
204 * @param introduction 群简介(最长120字节) 247 * @param introduction 群简介(最长120字节)
205 * @param succ 成功回调 248 * @param succ 成功回调
206 * @param fail 失败回调 249 * @param fail 失败回调
207 * 250 *
208 - * @return 0 成功 251 + * @return 0:成功;1:失败
209 */ 252 */
210 - (int)modifyGroupIntroduction:(NSString*)group introduction:(NSString*)introduction succ:(TIMSucc)succ fail:(TIMFail)fail; 253 - (int)modifyGroupIntroduction:(NSString*)group introduction:(NSString*)introduction succ:(TIMSucc)succ fail:(TIMFail)fail;
211 254
212 /** 255 /**
213 * 修改群公告 256 * 修改群公告
214 * 257 *
  258 + * 1. 公开群、聊天室、直播大群:只有群主或者管理员可以修改群公告。
  259 + * 2. 私有群:任何人可修改群公告。
  260 + *
215 * @param group 群组Id 261 * @param group 群组Id
216 * @param notification 群公告(最长150字节) 262 * @param notification 群公告(最长150字节)
217 * @param succ 成功回调 263 * @param succ 成功回调
218 * @param fail 失败回调 264 * @param fail 失败回调
219 * 265 *
220 - * @return 0 成功 266 + * @return 0:成功;1:失败
221 */ 267 */
222 - (int)modifyGroupNotification:(NSString*)group notification:(NSString*)notification succ:(TIMSucc)succ fail:(TIMFail)fail; 268 - (int)modifyGroupNotification:(NSString*)group notification:(NSString*)notification succ:(TIMSucc)succ fail:(TIMFail)fail;
223 269
224 /** 270 /**
225 * 修改群头像 271 * 修改群头像
226 * 272 *
  273 + * 1. 公开群、聊天室、直播大群:只有群主或者管理员可以修改群头像。
  274 + * 2. 私有群:任何人可修改群头像。
  275 + *
227 * @param group 群组Id 276 * @param group 群组Id
228 * @param url 群头像地址(最长100字节) 277 * @param url 群头像地址(最长100字节)
229 * @param succ 成功回调 278 * @param succ 成功回调
230 * @param fail 失败回调 279 * @param fail 失败回调
231 * 280 *
232 - * @return 0 成功 281 + * @return 0:成功;1:失败
233 */ 282 */
234 - (int)modifyGroupFaceUrl:(NSString*)group url:(NSString*)url succ:(TIMSucc)succ fail:(TIMFail)fail; 283 - (int)modifyGroupFaceUrl:(NSString*)group url:(NSString*)url succ:(TIMSucc)succ fail:(TIMFail)fail;
235 284
236 /** 285 /**
237 * 修改加群选项 286 * 修改加群选项
238 * 287 *
  288 + * 1. 公开群、聊天室、直播大群:只有群主或者管理员可以修改加群选项。
  289 + * 2. 私有群:只能通过邀请加入群组,不能主动申请加入某个群组。
  290 + *
239 * @param group 群组Id 291 * @param group 群组Id
240 * @param opt 加群选项,详见 TIMGroupAddOpt 292 * @param opt 加群选项,详见 TIMGroupAddOpt
241 * @param succ 成功回调 293 * @param succ 成功回调
242 * @param fail 失败回调 294 * @param fail 失败回调
243 * 295 *
244 - * @return 0 成功 296 + * @return 0:成功;1:失败
245 */ 297 */
246 - (int)modifyGroupAddOpt:(NSString*)group opt:(TIMGroupAddOpt)opt succ:(TIMSucc)succ fail:(TIMFail)fail; 298 - (int)modifyGroupAddOpt:(NSString*)group opt:(TIMGroupAddOpt)opt succ:(TIMSucc)succ fail:(TIMFail)fail;
247 299
248 /** 300 /**
249 * 修改群自定义字段集合 301 * 修改群自定义字段集合
250 * 302 *
  303 + * 通过 [IM 控制台](https://console.cloud.tencent.com/avc) -> 功能配置 -> 群维度自定义字段 配置相关的 key 和权限。
  304 + *
251 * @param group 群组Id 305 * @param group 群组Id
252 - * @param customInfo 自定义字段集合,key是NSString*类型,value是NSData*类型 306 + * @param customInfo 自定义字段集合,key 是 NSString* 类型,value 是 NSData* 类型
253 * @param succ 成功回调 307 * @param succ 成功回调
254 * @param fail 失败回调 308 * @param fail 失败回调
255 * 309 *
256 - * @return 0 成功 310 + * @return 0:成功;1:失败
257 */ 311 */
258 -- (int)modifyGroupCustomInfo:(NSString*)group customInfo:(NSDictionary*)customInfo succ:(TIMSucc)succ fail:(TIMFail)fail; 312 +- (int)modifyGroupCustomInfo:(NSString*)group customInfo:(NSDictionary<NSString *,NSData *>*)customInfo succ:(TIMSucc)succ fail:(TIMFail)fail;
259 313
260 /** 314 /**
261 * 转让群给新群主 315 * 转让群给新群主
262 * 316 *
  317 + * 1. 只有群主才有权限进行群转让操作。
  318 + * 2. 直播大群不能进行群转让操作。
  319 + *
263 * @param group 群组Id 320 * @param group 群组Id
264 * @param identifier 新的群主Id 321 * @param identifier 新的群主Id
265 * @param succ 成功回调 322 * @param succ 成功回调
266 * @param fail 失败回调 323 * @param fail 失败回调
267 * 324 *
268 - * @return 0 成功 325 + * @return 0:成功;1:失败
269 */ 326 */
270 - (int)modifyGroupOwner:(NSString*)group user:(NSString*)identifier succ:(TIMSucc)succ fail:(TIMFail)fail; 327 - (int)modifyGroupOwner:(NSString*)group user:(NSString*)identifier succ:(TIMSucc)succ fail:(TIMFail)fail;
271 328
272 /** 329 /**
273 * 修改接受消息选项 330 * 修改接受消息选项
274 * 331 *
  332 + * 默认情况下,公开群和私有群是接收并离线推送群消息,聊天室和直播大群是接收但不离线推送群消息。
  333 + *
275 * @param group 群组Id 334 * @param group 群组Id
276 * @param opt 接受消息选项,详见 TIMGroupReceiveMessageOpt 335 * @param opt 接受消息选项,详见 TIMGroupReceiveMessageOpt
277 * @param succ 成功回调 336 * @param succ 成功回调
278 * @param fail 失败回调 337 * @param fail 失败回调
279 * 338 *
280 - * @return 0 成功 339 + * @return 0:成功;1:失败
281 */ 340 */
282 - (int)modifyReciveMessageOpt:(NSString*)group opt:(TIMGroupReceiveMessageOpt)opt succ:(TIMSucc)succ fail:(TIMFail)fail; 341 - (int)modifyReciveMessageOpt:(NSString*)group opt:(TIMGroupReceiveMessageOpt)opt succ:(TIMSucc)succ fail:(TIMFail)fail;
283 342
284 /** 343 /**
285 * 修改群成员角色 344 * 修改群成员角色
286 * 345 *
  346 + * 1. 群主、管理员:可以进行对群成员的身份进行修改。
  347 + * 2. 直播大群:不支持修改用户群内身份。
  348 + *
287 * @param group 群组Id 349 * @param group 群组Id
288 * @param identifier 被修改角色的用户identifier 350 * @param identifier 被修改角色的用户identifier
289 * @param role 角色(注意:不能修改为群主),详见 TIMGroupMemberRole 351 * @param role 角色(注意:不能修改为群主),详见 TIMGroupMemberRole
290 * @param succ 成功回调 352 * @param succ 成功回调
291 * @param fail 失败回调 353 * @param fail 失败回调
292 * 354 *
293 - * @return 0 成功 355 + * @return 0:成功;1:失败
294 */ 356 */
295 - (int)modifyGroupMemberInfoSetRole:(NSString*)group user:(NSString*)identifier role:(TIMGroupMemberRole)role succ:(TIMSucc)succ fail:(TIMFail)fail; 357 - (int)modifyGroupMemberInfoSetRole:(NSString*)group user:(NSString*)identifier role:(TIMGroupMemberRole)role succ:(TIMSucc)succ fail:(TIMFail)fail;
296 358
297 /** 359 /**
298 - * 禁言用户(只有管理员或群主能够调用) 360 + * 禁言用户
  361 + *
  362 + * 只有管理员或群主能够调用
299 * 363 *
300 * @param group 群组Id 364 * @param group 群组Id
301 * @param identifier 被禁言的用户identifier 365 * @param identifier 被禁言的用户identifier
@@ -303,12 +367,14 @@ @@ -303,12 +367,14 @@
303 * @param succ 成功回调 367 * @param succ 成功回调
304 * @param fail 失败回调 368 * @param fail 失败回调
305 * 369 *
306 - * @return 0 成功 370 + * @return 0:成功;1:失败
307 */ 371 */
308 - (int)modifyGroupMemberInfoSetSilence:(NSString*)group user:(NSString*)identifier stime:(uint32_t)stime succ:(TIMSucc)succ fail:(TIMFail)fail; 372 - (int)modifyGroupMemberInfoSetSilence:(NSString*)group user:(NSString*)identifier stime:(uint32_t)stime succ:(TIMSucc)succ fail:(TIMFail)fail;
309 373
310 /** 374 /**
311 - * 修改群名片(只有本人、管理员或群主能够调用) 375 + * 修改群名片
  376 + *
  377 + * 只有本人、管理员或群主能够调用
312 * 378 *
313 * @param group 群组Id 379 * @param group 群组Id
314 * @param identifier 被操作用户identifier 380 * @param identifier 被操作用户identifier
@@ -316,22 +382,24 @@ @@ -316,22 +382,24 @@
316 * @param succ 成功回调 382 * @param succ 成功回调
317 * @param fail 失败回调 383 * @param fail 失败回调
318 * 384 *
319 - * @return 0 成功 385 + * @return 0:成功;1:失败
320 */ 386 */
321 - (int)modifyGroupMemberInfoSetNameCard:(NSString*)group user:(NSString*)identifier nameCard:(NSString*)nameCard succ:(TIMSucc)succ fail:(TIMFail)fail; 387 - (int)modifyGroupMemberInfoSetNameCard:(NSString*)group user:(NSString*)identifier nameCard:(NSString*)nameCard succ:(TIMSucc)succ fail:(TIMFail)fail;
322 388
323 /** 389 /**
324 * 修改群成员自定义字段集合 390 * 修改群成员自定义字段集合
325 * 391 *
326 - * @param group 群组Id  
327 - * @param identifier 被操作用户identifier  
328 - * @param customInfo 自定义字段集合,key是NSString*类型,value是NSData*类型 392 + * 通过 [IM 控制台](https://console.cloud.tencent.com/avc) -> 功能配置 -> 群成员维度自定义字段 配置相关的 key 和权限。
  393 + *
  394 + * @param group 群组 Id
  395 + * @param identifier 被操作用户 identifier
  396 + * @param customInfo 自定义字段集合,key 是 NSString* 类型,value 是 NSData* 类型
329 * @param succ 成功回调 397 * @param succ 成功回调
330 * @param fail 失败回调 398 * @param fail 失败回调
331 * 399 *
332 - * @return 0 成功 400 + * @return 0:成功;1:失败
333 */ 401 */
334 -- (int)modifyGroupMemberInfoSetCustomInfo:(NSString*)group user:(NSString*)identifier customInfo:(NSDictionary*)customInfo succ:(TIMSucc)succ fail:(TIMFail)fail; 402 +- (int)modifyGroupMemberInfoSetCustomInfo:(NSString*)group user:(NSString*)identifier customInfo:(NSDictionary<NSString*,NSData*> *)customInfo succ:(TIMSucc)succ fail:(TIMFail)fail;
335 403
336 /** 404 /**
337 * 修改群组是否可被搜索属性 405 * 修改群组是否可被搜索属性
@@ -341,7 +409,7 @@ @@ -341,7 +409,7 @@
341 * @param succ 成功回调 409 * @param succ 成功回调
342 * @param fail 失败回调 410 * @param fail 失败回调
343 * 411 *
344 - * @return 0 成功 412 + * @return 0:成功;1:失败
345 */ 413 */
346 - (int)modifyGroupSearchable:(NSString*)group searchable:(BOOL)searchable succ:(TIMSucc)succ fail:(TIMFail)fail; 414 - (int)modifyGroupSearchable:(NSString*)group searchable:(BOOL)searchable succ:(TIMSucc)succ fail:(TIMFail)fail;
347 415
@@ -353,55 +421,52 @@ @@ -353,55 +421,52 @@
353 * @param succ 成功回调 421 * @param succ 成功回调
354 * @param fail 失败回调 422 * @param fail 失败回调
355 * 423 *
356 - * @return 0 成功 424 + * @return 0:成功;1:失败
357 */ 425 */
358 - (int)modifyGroupMemberVisible:(NSString*)group visible:(BOOL)visible succ:(TIMSucc)succ fail:(TIMFail)fail; 426 - (int)modifyGroupMemberVisible:(NSString*)group visible:(BOOL)visible succ:(TIMSucc)succ fail:(TIMFail)fail;
359 427
360 /** 428 /**
361 * 修改群组全员禁言属性 429 * 修改群组全员禁言属性
362 * 430 *
  431 + * 1. 群主、管理员:有权限进行全员禁言的操作。
  432 + * 2. 所有群组类型:都支持全员禁言的操作。
  433 + *
363 * @param group 群组Id 434 * @param group 群组Id
364 * @param shutup 是否禁言 435 * @param shutup 是否禁言
365 * @param succ 成功回调 436 * @param succ 成功回调
366 * @param fail 失败回调 437 * @param fail 失败回调
367 * 438 *
368 - * @return 0 成功 439 + * @return 0:成功;1:失败
369 */ 440 */
370 - (int)modifyGroupAllShutup:(NSString*)group shutup:(BOOL)shutup succ:(TIMSucc)succ fail:(TIMFail)fail; 441 - (int)modifyGroupAllShutup:(NSString*)group shutup:(BOOL)shutup succ:(TIMSucc)succ fail:(TIMFail)fail;
371 442
372 /** 443 /**
373 * 获取群组未决列表 444 * 获取群组未决列表
374 * 445 *
  446 + * 1. 群未决消息泛指所有需要审批的群相关的操作(例如:加群待审批,拉人入群待审批等等)。即便审核通过或者拒绝后,该条信息也可通过此接口拉回,拉回的信息中有已决标志
  447 + * 2. 审批人:有权限拉取相关信息,如果 UserA 申请加入群 GroupA,则群管理员可获取此未决相关信息,UserA 因为没有审批权限,不需要拉取未决信息。如果 AdminA 拉 UserA 进去 GroupA,则 UserA 可以拉取此未决相关信息,因为该未决信息待 UserA 审批。
  448 + *
375 * @param option 未决参数配置 449 * @param option 未决参数配置
376 * @param succ 成功回调,返回未决列表 450 * @param succ 成功回调,返回未决列表
377 * @param fail 失败回调 451 * @param fail 失败回调
378 * 452 *
379 - * @return 0 成功 453 + * @return 0:成功;1:失败
380 */ 454 */
381 - (int)getPendencyFromServer:(TIMGroupPendencyOption*)option succ:(TIMGetGroupPendencyListSucc)succ fail:(TIMFail)fail; 455 - (int)getPendencyFromServer:(TIMGroupPendencyOption*)option succ:(TIMGetGroupPendencyListSucc)succ fail:(TIMFail)fail;
382 456
383 /** 457 /**
384 * 群未决已读上报 458 * 群未决已读上报
385 * 459 *
  460 + * 对于未决信息,SDK 可对其和之前的所有未决信息上报已读。上报已读后,仍然可以拉取到这些未决信息,但可通过对已读时戳的判断判定未决信息是否已读。
  461 + *
386 * @param timestamp 上报已读时间戳 462 * @param timestamp 上报已读时间戳
387 * @param succ 成功回调 463 * @param succ 成功回调
388 * @param fail 失败回调 464 * @param fail 失败回调
389 * 465 *
390 - * @return 0 成功 466 + * @return 0:成功;1:失败
391 */ 467 */
392 - (int)pendencyReport:(uint64_t)timestamp succ:(TIMSucc)succ fail:(TIMFail)fail; 468 - (int)pendencyReport:(uint64_t)timestamp succ:(TIMSucc)succ fail:(TIMFail)fail;
393 469
394 -#pragma mark - 开启本地缓存后有效  
395 -  
396 -/**  
397 - * 获取用户所在群组信息  
398 - *  
399 - * @param groups 群组id(NSString*)列表,nil时返回群组列表  
400 - *  
401 - * @return 群组信息(TIMGroupInfo*)列表,assistant未同步时返回nil  
402 - */  
403 -- (NSArray*)getGroupInfo:(NSArray*)groups;  
404 -  
405 @end 470 @end
406 471
407 #endif /* TIMGroupManager_Ext_h */ 472 #endif /* TIMGroupManager_Ext_h */
@@ -24,47 +24,63 @@ @@ -24,47 +24,63 @@
24 /** 24 /**
25 * 创建群组 25 * 创建群组
26 * 26 *
  27 + * 1. 默认创建群组时,IM 通讯云服务器会生成一个唯一的 ID,该 ID 将以 @TGS# 开头,且保证在 App 中唯一,以便后续操作。
  28 + * 2. 如果用户需要自定义群组 ID,在创建时可指定 ID,自定义群组 ID 必须为可打印 ASCII 字符(0x20-0x7e),最长 48 个字节,且前缀不能为 @TGS#(避免与默认分配的群组 ID 混淆)
  29 + *
27 * @param type 群类型,Private,Public,ChatRoom,AVChatRoom 30 * @param type 群类型,Private,Public,ChatRoom,AVChatRoom
28 - * @param groupId 自定义群组id,为空时系统自动分配 31 + * @param groupId 自定义群组 ID,为空时系统自动分配
29 * @param groupName 群组名称 32 * @param groupName 群组名称
30 * @param succ 成功回调 33 * @param succ 成功回调
31 * @param fail 失败回调 34 * @param fail 失败回调
32 * 35 *
33 - * @return 0 成功 36 + * @return 0:成功;1:失败
34 */ 37 */
35 - (int)createGroup:(NSString*)type groupId:(NSString*)groupId groupName:(NSString*)groupName succ:(TIMCreateGroupSucc)succ fail:(TIMFail)fail; 38 - (int)createGroup:(NSString*)type groupId:(NSString*)groupId groupName:(NSString*)groupName succ:(TIMCreateGroupSucc)succ fail:(TIMFail)fail;
36 39
37 /** 40 /**
38 * 解散群组 41 * 解散群组
39 * 42 *
  43 + * 1. 私有群:任何人都无法解散群组
  44 + * 2. 公开群、聊天室、直播大群:群主可以解散群组。
  45 + *
40 * @param group 群组Id 46 * @param group 群组Id
41 * @param succ 成功回调 47 * @param succ 成功回调
42 * @param fail 失败回调 48 * @param fail 失败回调
43 * 49 *
44 - * @return 0 成功 50 + * @return 0:成功;1:失败
45 */ 51 */
46 - (int)deleteGroup:(NSString*)group succ:(TIMSucc)succ fail:(TIMFail)fail; 52 - (int)deleteGroup:(NSString*)group succ:(TIMSucc)succ fail:(TIMFail)fail;
47 53
48 /** 54 /**
49 * 申请加群 55 * 申请加群
50 * 56 *
  57 + * 1. 私有群:不能由用户主动申请入群。
  58 + * 2. 公开群、聊天室:可以主动申请进入。
  59 + * 3. 直播大群:可以任意加入群组。
  60 + * 4. 如果群组设置为需要审核,申请入群后管理员和群主会收到申请入群系统消息 TIMGroupSystemElem,判断 TIMGroupSystemElem 的 Type 类型如果是 TIM_GROUP_SYSTEM_ADD_GROUP_REQUEST_TYPE ,调用消息的 accept 接口同意入群,申请人会收到同意入群的消息 TIMGroupSystemElem(Type:TIM_GROUP_SYSTEM_ADD_GROUP_ACCEPT_TYPE),调用 refuse 接口拒绝入群,申请人会收到拒绝入群的消息 TIMGroupSystemElem(Type:TIM_GROUP_SYSTEM_ADD_GROUP_REFUSE_TYPE)。
  61 + * 5. 如果群主设置为任何人可加入,则直接入群成功。
  62 + *
51 * @param group 申请加入的群组Id 63 * @param group 申请加入的群组Id
52 * @param msg 申请消息 64 * @param msg 申请消息
53 * @param succ 成功回调(申请成功等待审批) 65 * @param succ 成功回调(申请成功等待审批)
54 * @param fail 失败回调 66 * @param fail 失败回调
55 * 67 *
56 - * @return 0 成功 68 + * @return 0:成功;1:失败
57 */ 69 */
58 - (int)joinGroup:(NSString*)group msg:(NSString*)msg succ:(TIMSucc)succ fail:(TIMFail)fail; 70 - (int)joinGroup:(NSString*)group msg:(NSString*)msg succ:(TIMSucc)succ fail:(TIMFail)fail;
59 71
60 /** 72 /**
61 * 主动退出群组 73 * 主动退出群组
62 * 74 *
  75 + * 1. 私有群:全员可退出群组。
  76 + * 2. 公开群、聊天室、直播大群:群主不能退出。
  77 + * 3. 当用户主动退出群组时,该用户会收到退群消息 TIMGroupSystemElem(Type:TIM_GROUP_SYSTEM_QUIT_GROUP_TYPE),只有退群的用户自己可以收到。当用户调用 QuitGroup 时成功回调返回,表示已退出成功,此消息主要为了多终端同步,其他终端可以作为更新群列表的时机,本终端可以选择忽略。
  78 + *
63 * @param group 群组Id 79 * @param group 群组Id
64 * @param succ 成功回调 80 * @param succ 成功回调
65 * @param fail 失败回调 81 * @param fail 失败回调
66 * 82 *
67 - * @return 0 成功 83 + * @return 0:成功;1:失败
68 */ 84 */
69 - (int)quitGroup:(NSString*)group succ:(TIMSucc)succ fail:(TIMFail)fail; 85 - (int)quitGroup:(NSString*)group succ:(TIMSucc)succ fail:(TIMFail)fail;
70 86
@@ -9,7 +9,7 @@ @@ -9,7 +9,7 @@
9 #ifndef TIMManager_MsgExt_h 9 #ifndef TIMManager_MsgExt_h
10 #define TIMManager_MsgExt_h 10 #define TIMManager_MsgExt_h
11 11
12 -#import "ImSDK.h" 12 +#import "TIMManager.h"
13 #import "TIMComm+MsgExt.h" 13 #import "TIMComm+MsgExt.h"
14 14
15 @class TIMMessage; 15 @class TIMMessage;
@@ -38,20 +38,22 @@ @@ -38,20 +38,22 @@
38 /** 38 /**
39 * 删除会话 39 * 删除会话
40 * 40 *
41 - * @param type 会话类型,TIM_C2C 表示单聊 TIM_GROUP 表示群聊  
42 - * @param receiver 用户identifier 或者 群组Id 41 + * @param type 会话类型,TIM_C2C:表示单聊;TIM_GROUP:表示群聊
  42 + * @param receiver 用户 identifier 或者群组 Id
43 * 43 *
44 - * @return TRUE:删除成功 FALSE:删除失败 44 + * @return TRUE:删除成功FALSE:删除失败
45 */ 45 */
46 - (BOOL)deleteConversation:(TIMConversationType)type receiver:(NSString*)receiver; 46 - (BOOL)deleteConversation:(TIMConversationType)type receiver:(NSString*)receiver;
47 47
48 /** 48 /**
49 * 删除会话和消息 49 * 删除会话和消息
50 * 50 *
51 - * @param type 会话类型,TIM_C2C 表示单聊 TIM_GROUP 表示群聊  
52 - * @param receiver 用户identifier 或者 群组Id 51 + * 这里只是删除本地消息,通过 getMessage 会拉取到漫游消息,所以存在删除消息成功,但是拉取到消息的情况,取决于是否重新从漫游拉回到本地。如果不需要拉取漫游,可以通过 getLocalMessage 获取本地消息,或者只通过 getMessage 拉取指定条数(如未读条数数量)的消息。
53 * 52 *
54 - * @return TRUE:删除成功 FALSE:删除失败 53 + * @param type 会话类型,TIM_C2C:表示单聊;TIM_GROUP:表示群聊
  54 + * @param receiver 用户identifier 或者 群组 Id
  55 + *
  56 + * @return TRUE:删除成功;FALSE:删除失败
55 */ 57 */
56 - (BOOL)deleteConversationAndMessages:(TIMConversationType)type receiver:(NSString*)receiver; 58 - (BOOL)deleteConversationAndMessages:(TIMConversationType)type receiver:(NSString*)receiver;
57 59
@@ -63,13 +65,15 @@ @@ -63,13 +65,15 @@
63 - (int)conversationCount; 65 - (int)conversationCount;
64 66
65 /** 67 /**
66 - * 初始化存储,仅查看历史消息时使用,如果要收发消息等操作,如login成功,不需要调用此函数 68 + * 初始化存储
  69 + *
  70 + * 仅查看历史消息时使用,如果要收发消息等操作,如login成功,不需要调用此函数
67 * 71 *
68 - * @param param 登陆参数(userSig 不用填写) 72 + * @param param 登陆参数(identifier 必须填写,userSig 不用填写)
69 * @param succ 成功回调,收到回调时,可以获取会话列表和消息 73 * @param succ 成功回调,收到回调时,可以获取会话列表和消息
70 * @param fail 失败回调 74 * @param fail 失败回调
71 * 75 *
72 - * @return 0 请求成功 76 + * @return 0:请求成功;1:请求失败,identifier 为 nil 或则用户已登录
73 */ 77 */
74 - (int)initStorage:(TIMLoginParam*)param succ:(TIMLoginSucc)succ fail:(TIMFail)fail; 78 - (int)initStorage:(TIMLoginParam*)param succ:(TIMLoginSucc)succ fail:(TIMFail)fail;
75 79
@@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@
13 #import "TIMCallback.h" 13 #import "TIMCallback.h"
14 14
15 @class TIMGroupManager; 15 @class TIMGroupManager;
16 -//@class TIMFriendshipManager; 16 +@class TIMFriendshipManager;
17 17
18 ///////////////////////////////////////////////////////// 18 /////////////////////////////////////////////////////////
19 /// Tencent 开放 SDK API 19 /// Tencent 开放 SDK API
@@ -24,255 +24,336 @@ @@ -24,255 +24,336 @@
24 */ 24 */
25 @interface TIMManager : NSObject 25 @interface TIMManager : NSObject
26 26
  27 +/////////////////////////////////////////////////////////////////////////////////
  28 +//
  29 +// (一)初始化相关接口函数
  30 +//
  31 +/////////////////////////////////////////////////////////////////////////////////
27 32
  33 +/// @name 初始化相关接口
  34 +/// @{
28 /** 35 /**
29 - * 获取管理器实例 36 + * 1.1 获取管理器实例 TIMManager
30 * 37 *
31 * @return 管理器实例 38 * @return 管理器实例
32 */ 39 */
33 + (TIMManager*)sharedInstance; 40 + (TIMManager*)sharedInstance;
34 41
35 /** 42 /**
36 - * 初始化SDK 43 + * 1.2 初始化 SDK,设置全局配置信息
  44 + *
  45 + * 初始化 SDK 需要设置 TIMSdkConfig 信息,TIMSdkConfig 主要包含 sdkAppId 设置、Log 相关逻辑设置、数据库存储路径设置、网络监听设置等,其中 sdkAppId 的获取请参考官网文档 [跑通Demo(iOS与Mac)](https://cloud.tencent.com/document/product/269/32674)。
37 * 46 *
38 - * @param config 配置信息,全局有效 47 + * @param config 配置信息,全局有效,详情请参考 TIMComm.h 中的 TIMSdkConfig 定义
39 * 48 *
40 - * @return 0 成功 49 + * @return 0:成功;1:失败,config 为 nil
41 */ 50 */
42 - (int)initSdk:(TIMSdkConfig*)config; 51 - (int)initSdk:(TIMSdkConfig*)config;
43 52
44 /** 53 /**
45 - * 获取全局配置 54 + * 1.3 获取全局配置信息
46 * 55 *
47 - * @return 全局配置 56 + * 获取初始化 SDK 时候设置的 TIMSdkConfig,方便客户在上层做相关业务逻辑。
  57 + *
  58 + * @return 全局配置,详情请参考 TIMComm.h 中的 TIMSdkConfig 定义
48 */ 59 */
49 - (TIMSdkConfig*)getGlobalConfig; 60 - (TIMSdkConfig*)getGlobalConfig;
50 61
51 /** 62 /**
52 - * 初始化当前manager,在initSdk:后调用,login:前调用 63 + * 1.4 设置用户配置信息
  64 + *
  65 + * 1. setUserConfig 要在 initSdk 之后,login 之前,主要用来开启/关闭自动已读上报和已读回执,设置默认拉取的群组资料,群成员资料字段,监听用户登录状态、会话刷新、消息已读回执、文件上传进度、群组事件通知。
  66 + * 2. 自动已读上报默认是开启的,当客户端收到一条未读消息后,Server 默认会删除这条未读消息,切换终端以后无法看到之前终端已经拉回的未读消息,如果需要多终端情况下仍然会有未读,请设置 TIMUserConfig 中的 disableAutoReport 为 YES,一旦禁用自动上报,开发者需要显式调用 setReadMessage,详情请参考官方文档 [未读消息计数](https://cloud.tencent.com/document/product/269/9151)。
  67 + * 3. C2C 已读回执默认是关闭的,如果需要开启,请设置 TIMUserConfig 中的 enableReadReceipt 为 YES,收到消息的用户需要显式调用 setReadMessage,发消息的用户才能通过 TIMMessageReceiptListener 监听到消息的已读回执。
  68 + * 4. 当您获取群资料的时候,默认只能拉取内置字段,如果想要拉取自定义字段,首先要通过 [IM 控制台](https://console.cloud.tencent.com/avc) -> 功能配置 -> 群维度自定义字段 配置相关的 key 和权限,然后把生成的 key 设置在 IMGroupInfoOption 里面的 groupCustom 字段。需要注意的是,只有对自定义字段 value 做了赋值或则修改,才能拉取到自定义字段。
  69 + * 5. 当您获取群成员资料的时候,默认只能拉取内置字段,如果想要拉取自定义字段,首先要通过 [IM 控制台](https://console.cloud.tencent.com/avc) -> 功能配置 -> 群成员维度自定义字段配置相关的 key 和权限,然后把生成的 key 设置在 TIMGroupMemberInfoOption 里面的 memberCustom 字段。需要注意的是,只有对自定义字段的 value 做了赋值或则修改,才能拉取到自定义字段。
53 * 70 *
54 - * @param config 配置信息,对当前TIMManager有效 71 + * @param config 配置信息,对当前 TIMManager 有效,详情请参考 TIMComm.h 中的 TIMUserConfig 定义
55 * 72 *
56 - * @return 0 成功 73 + * @return 0:成功;1:失败,config 为 nil
57 */ 74 */
58 - (int)setUserConfig:(TIMUserConfig*)config; 75 - (int)setUserConfig:(TIMUserConfig*)config;
59 76
60 /** 77 /**
61 - * 获取当前manager绑定用户的配置 78 + * 1.5 获取用户配置信息
  79 + *
  80 + * 获取设置的用户配置信息 TIMSdkConfig,方便客户在上层做相关业务逻辑。
62 * 81 *
63 - * @return 当前manager绑定用户的配置 82 + * @return 当前 manager 绑定用户的配置,详情请参考 TIMComm.h 中的 TIMUserConfig 定义
64 */ 83 */
65 - (TIMUserConfig*)getUserConfig; 84 - (TIMUserConfig*)getUserConfig;
66 85
67 /** 86 /**
68 - * 添加消息回调(重复添加无效) 87 + * 1.6 添加消息监听(重复添加无效)
69 * 88 *
70 - * @param listener 回调 89 + * 添加消息监听后,会在 TIMMessageListener 的 onNewMessage 收到回调消息,消息内容通过参数 TIMMessage 传递,通过 TIMMessage 可以获取消息和相关会话的详细信息,如消息文本,语音数据,图片等。详细可参阅 [消息解析](https://cloud.tencent.com/document/product/269/9150#.E6.B6.88.E6.81.AF.E8.A7.A3.E6.9E.90) 部分。
71 * 90 *
72 - * @return 成功 91 + * @param listener 回调,详情请参考 TIMCallback.h 中的 TIMMessageListener 定义
  92 + *
  93 + * @return 0:成功;1:失败,listener 为 nil
73 */ 94 */
74 - (int)addMessageListener:(id<TIMMessageListener>)listener; 95 - (int)addMessageListener:(id<TIMMessageListener>)listener;
75 96
76 /** 97 /**
77 - * 移除消息回调 98 + * 1.7 移除消息监听
78 * 99 *
79 - * @param listener 回调 100 + * @param listener 回调,详情请参考 TIMCallback.h 中的 TIMMessageListener 定义
80 * 101 *
81 - * @return 成功 102 + * @return 0:成功;1:失败,listener 为 nil
82 */ 103 */
83 - (int)removeMessageListener:(id<TIMMessageListener>)listener; 104 - (int)removeMessageListener:(id<TIMMessageListener>)listener;
84 105
  106 +/// @}
  107 +
  108 +/////////////////////////////////////////////////////////////////////////////////
  109 +//
  110 +// (二)登录相关接口
  111 +//
  112 +/////////////////////////////////////////////////////////////////////////////////
  113 +
  114 +/// @name 登录相关接口
  115 +/// @{
85 /** 116 /**
86 - * 登陆 117 + * 2.1 登录
  118 + *
  119 + * 1. 登录需要设置用户名 identifier 和用户签名 userSig,userSig 的生成请参考官网文档 [UserSig 后台 API](https://cloud.tencent.com/document/product/269/32688)。
  120 + * 2. 如果 userSig 过期,登录会返回 ERR_USER_SIG_EXPIRED:6206 错误码,收到错误码后请生成新的 userSig 重新登录。
  121 + * 3. 用户在线情况下被踢,会在 TIMUserConfig 里面配置的 TIMUserStatusListener 监听器获取 onForceOffline 回调,收到回调后可以选择重新登录。
  122 + * 4. 用户离线状态下被踢,由于此时用户不在线,无法感知此事件,为了显式提醒用户,用户重新登录时,会返回 ERR_IMSDK_KICKED_BY_OTHERS:6208 错误码,表明之前被踢,如果需要把对方踢下线,再次调用 login 强制上线,更多详情请参考 [用户状态变更](https://cloud.tencent.com/document/product/269/9148#5.-.E7.94.A8.E6.88.B7.E7.8A.B6.E6.80.81.E5.8F.98.E6.9B.B4)。
87 * 123 *
88 - * @param param 登陆参数  
89 - * @param succ 成功回调  
90 - * @param fail 失败回调 124 + * @param param 登陆参数,详情请参考 TIMComm.h 中的 TIMLoginParam 定义
  125 + * @param succ 成功回调,详情请参考 TIMComm.h 中的 TIMLoginSucc 定义
  126 + * @param fail 失败回调,详情请参考 TIMComm.h 中的 TIMFail 定义
91 * 127 *
92 - * @return 0 请求成功 128 + * @return 0:成功;1:失败,请检查 param 参数是否正常
93 */ 129 */
94 - (int)login: (TIMLoginParam*)param succ:(TIMLoginSucc)succ fail:(TIMFail)fail; 130 - (int)login: (TIMLoginParam*)param succ:(TIMLoginSucc)succ fail:(TIMFail)fail;
95 131
96 /** 132 /**
97 - * 获取当前登陆的用户 133 + * 2.2 自动登录
98 * 134 *
99 - * @return 如果登陆返回用户的identifier,如果未登录返回nil  
100 - */  
101 -- (NSString*)getLoginUser;  
102 -  
103 -/**  
104 - * 获取当前登录状态 135 + * 1. 首次登陆之后,SDK 会把登陆信息存在在本地,下次登陆即可调用自动登录
  136 + * 2. 如果用户之前没有登录过,或则 APP 被卸载过,自动登录会报 ERR_NO_PREVIOUS_LOGIN:6026 错误,这个时候请调用 login 接口重新登录。
  137 + *
  138 + * @param param 登陆参数( userSig 不用填),详情请参考 TIMComm.h 中的 TIMLoginParam 定义
  139 + * @param succ 成功回调,详情请参考 TIMComm.h 中的 TIMLoginSucc 定义
  140 + * @param fail 失败回调,详情请参考 TIMComm.h 中的 TIMFail 定义
105 * 141 *
106 - * @return 登录状态 142 + * @return 0:成功;1:失败,请检查 param 参数是否正常
107 */ 143 */
108 -- (TIMLoginStatus)getLoginStatus; 144 +- (int)autoLogin:(TIMLoginParam*)param succ:(TIMLoginSucc)succ fail:(TIMFail)fail;
109 145
110 /** 146 /**
111 - * 登出 147 + * 2.3 登出
  148 + *
  149 + * 退出登录,如果切换账号,需要 logout 回调成功或者失败后才能再次 login,否则 login 可能会失败。
112 * 150 *
113 * @param succ 成功回调,登出成功 151 * @param succ 成功回调,登出成功
114 * @param fail 失败回调,返回错误吗和错误信息 152 * @param fail 失败回调,返回错误吗和错误信息
115 * 153 *
116 - * @return 0 发送登出包成功,等待回调 154 + * @return 0:发送登出包成功,等待回调;1:失败
117 */ 155 */
118 - (int)logout:(TIMLoginSucc)succ fail:(TIMFail)fail; 156 - (int)logout:(TIMLoginSucc)succ fail:(TIMFail)fail;
119 157
120 -#pragma mark - 消息会话操作  
121 -  
122 /** 158 /**
123 - * 获取会话  
124 - *  
125 - * @param type 会话类型,TIM_C2C 表示单聊 TIM_GROUP 表示群聊  
126 - * TIM_SYSTEM 表示系统会话  
127 - * @param receiver C2C 为对方用户 identifier,GROUP 为群组Id,SYSTEM为@"" 159 + * 2.4 获取当前登陆的用户
128 * 160 *
129 - * @return 会话对象 161 + * @return 如果登陆返回用户的 identifier,如果未登录返回 nil
130 */ 162 */
131 -- (TIMConversation*)getConversation:(TIMConversationType)type receiver:(NSString*)receiver;  
132 -  
133 -#pragma mark - APNs推送 163 +- (NSString*)getLoginUser;
134 164
135 /** 165 /**
136 - * 设置Token,需要登录后调用  
137 - *  
138 - * @param token token信息  
139 - * @param succ 成功回调  
140 - * @param fail 失败回调 166 + * 2.5 获取当前登录状态
141 * 167 *
142 - * @return 0 成功 168 + * @return 登录状态,详情请参考 TIMComm.h 中的 TIMLoginStatus 定义
143 */ 169 */
144 -- (int)setToken:(TIMTokenParam*)token succ:(TIMSucc)succ fail:(TIMFail)fail; 170 +- (TIMLoginStatus)getLoginStatus;
145 171
146 -/**  
147 - * 设置APNS配置  
148 - *  
149 - * @param config APNS配置  
150 - * @param succ 成功回调  
151 - * @param fail 失败回调  
152 - *  
153 - * @return 0 成功  
154 - */  
155 -- (int)setAPNS:(TIMAPNSConfig*)config succ:(TIMSucc)succ fail:(TIMFail)fail; 172 +/// @}
156 173
  174 +/////////////////////////////////////////////////////////////////////////////////
  175 +//
  176 +// (三)获取会话管理器
  177 +//
  178 +/////////////////////////////////////////////////////////////////////////////////
  179 +/// @name 获取会话管理器
  180 +/// @{
157 /** 181 /**
158 - * 获取APNS配置 182 + * 获取会话管理器
159 * 183 *
160 - * @param succ 成功回调,返回配置信息  
161 - * @param fail 失败回调 184 + * TIMConversation 负责会话相关操作,包含发送消息、获取会话消息缓存、获取未读计数等。
162 * 185 *
163 - * @return 0 成功 186 + * @param type 会话类型,TIM_C2C:单聊;TIM_GROUP:群聊;TIM_SYSTEM:系统会话
  187 + * @param receiver 会话接收者,C2C:为对方用户;identifier;GROUP:群组 Id;SYSTEM:@""
  188 + *
  189 + * @return 会话对象,详情请参考 TIMConversation.h 里面的 TIMConversation 定义
164 */ 190 */
165 -- (int)getAPNSConfig:(TIMAPNSConfigSucc)succ fail:(TIMFail)fail; 191 +- (TIMConversation*)getConversation:(TIMConversationType)type receiver:(NSString*)receiver;
166 192
  193 +/// @}
  194 +
  195 +/////////////////////////////////////////////////////////////////////////////////
  196 +//
  197 +// (四)获取群管理器
  198 +//
  199 +/////////////////////////////////////////////////////////////////////////////////
  200 +/// @name 获取群管理器
  201 +/// @{
167 /** 202 /**
168 - * app 切后台时调用 203 + * 获取群管理器
169 * 204 *
170 - * @param param 上报参数  
171 - * @param succ 成功时回调  
172 - * @param fail 失败时回调 205 + * TIMGroupManager 负责创建群、增删成员、以及修改群资料等
173 * 206 *
174 - * @return 0 表示成功 207 + * @return 群管理器,详情请参考 TIMGroupManager.h 中的 TIMGroupManager 定义
175 */ 208 */
176 -- (int)doBackground:(TIMBackgroundParam*)param succ:(TIMSucc)succ fail:(TIMFail)fail; 209 +- (TIMGroupManager*)groupManager;
177 210
  211 +/// @}
178 212
  213 +/////////////////////////////////////////////////////////////////////////////////
  214 +//
  215 +// (五)获取好友管理器
  216 +//
  217 +/////////////////////////////////////////////////////////////////////////////////
  218 +///@name 获取好友管理器
  219 +/// @{
179 /** 220 /**
180 - * 切前台 221 + * 获取好友管理器
181 * 222 *
182 - * @param succ 成功时回调  
183 - * @param fail 失败时回调 223 + * TIMFriendshipManager 负责加好友,删除好友,查询好友列表等
184 * 224 *
185 - * @return 0 表示成功 225 + * @return 好友管理器,详情请参考 TIMFriendshipManager.h 中的 TIMFriendshipManager 定义
186 */ 226 */
187 -- (int)doForeground:(TIMSucc)succ fail:(TIMFail)fail;  
188 -  
189 -#pragma mark - 调试使用 227 +- (TIMFriendshipManager*)friendshipManager;
190 228
191 -/**  
192 - * 获取网络状态  
193 - */  
194 -- (TIMNetworkStatus)networkStatus; 229 +/// @}
195 230
  231 +/////////////////////////////////////////////////////////////////////////////////
  232 +//
  233 +// (六)设置 APNs 推送
  234 +//
  235 +/////////////////////////////////////////////////////////////////////////////////
  236 +/// @name 设置 APNs 推送
  237 +/// @{
196 /** 238 /**
197 - * 设置环境(在InitSdk之前调用,注意:除非是IM工作人员指定要求设置,否则不需要调用此接口) 239 + * 6.1. 设置客户端 Token 和证书 busiId
  240 + *
  241 + * 1. token 是向苹果后台请求 DeviceToken,具体实现请参考 appdelegate.h 里面的 registNotification。
  242 + * 2. busiId 是向 IM 控制台上传 iOS 证书(p.12)生成的,具体步骤请参考 [离线推送](https://cloud.tencent.com/document/product/269/9154)。
  243 + *
  244 + * @param token 详情请参考 TIMComm.h 中的 TIMTokenParam 定义
  245 + * @param succ 成功回调,详情请参考 TIMComm.h 中的 TIMSucc 定义
  246 + * @param fail 失败回调,详情请参考 TIMComm.h 中的 TIMFail 定义
198 * 247 *
199 - * @param env 0 正式环境(默认)  
200 - * 1 测试环境 248 + * @return 0:成功;1:失败,token 参数异常
201 */ 249 */
202 -- (void)setEnv:(int)env; 250 +- (int)setToken:(TIMTokenParam*)token succ:(TIMSucc)succ fail:(TIMFail)fail;
203 251
204 /** 252 /**
205 - * 获取环境类型 253 + * 6.2. 设置推送声音
  254 + *
  255 + * 不同用户可能想使用不同的推送声音,TIMAPNSConfig 提供了设置用户声音的字段,可实现单聊声音、群组声音的设置,也可在用户级别设置是否开启推送。
  256 + *
  257 + * @param config APNS 配置,详情请参考 TIMComm.h 中的 TIMAPNSConfig 定义
  258 + * @param succ 成功回调,详情请参考 TIMComm.h 中的 TIMSucc 定义
  259 + * @param fail 失败回调,详情请参考 TIMComm.h 中的 TIMFail 定义
206 * 260 *
207 - * @return env 0 正式环境(默认)  
208 - * 1 测试环境  
209 - * 2 beta 环境 261 + * @return 0:成功;1:失败,config 参数异常
210 */ 262 */
211 -- (int)getEnv; 263 +- (int)setAPNS:(TIMAPNSConfig*)config succ:(TIMSucc)succ fail:(TIMFail)fail;
212 264
213 /** 265 /**
214 - * 获取版本号 266 + * 6.3. 获取推送声音设置
  267 + *
  268 + * @param succ 成功回调,返回配置信息,详情请参考 TIMComm.h 中的 TIMAPNSConfigSucc 定义
  269 + * @param fail 失败回调,详情请参考 TIMComm.h 中的 TIMFail 定义
215 * 270 *
216 - * @return 返回版本号,字符串表示,例如v1.1.1 271 + * @return 0:成功;1:失败
217 */ 272 */
218 -- (NSString*)GetVersion; 273 +- (int)getAPNSConfig:(TIMAPNSConfigSucc)succ fail:(TIMFail)fail;
219 274
220 /** 275 /**
221 - * 获取联网SDK的版本号 276 + * 6.4. APP 进后台
  277 + *
  278 + * APP 进后台的时候需要主动调用 doBackground ,这个时候后台知道 APP 的状态,之后的消息会下发推送通知。
222 * 279 *
223 - * @return 返回版本号 280 + * @param param 上报参数,详情请参考 TIMComm.h 中的 TIMBackgroundParam 定义
  281 + * @param succ 成功时回调,详情请参考 TIMComm.h 中的 TIMSucc 定义
  282 + * @param fail 失败时回调,详情请参考 TIMComm.h 中的 TIMFail 定义
  283 + *
  284 + * @return 0:成功;1:失败
224 */ 285 */
225 -- (NSString*)GetQALVersion; 286 +- (int)doBackground:(TIMBackgroundParam*)param succ:(TIMSucc)succ fail:(TIMFail)fail;
  287 +
226 288
227 /** 289 /**
228 - * 打印日志,通过ImSDK提供的日志功能打印日志 290 + * 6.5. APP 进后台
229 * 291 *
230 - * @param level 日志级别  
231 - * @param tag 模块tag  
232 - * @param msg 要输出的日志内容 292 + * APP 进前台的时候需要主动调用 doForeground。
  293 + *
  294 + * @param succ 成功时回调,详情请参考 TIMComm.h 中的 TIMSucc 定义
  295 + * @param fail 失败时回调,详情请参考 TIMComm.h 中的 TIMFail 定义
  296 + *
  297 + * @return 0:成功;1:失败
233 */ 298 */
234 -- (void)log:(TIMLogLevel)level tag:(NSString*)tag msg:(NSString*)msg; 299 +- (int)doForeground:(TIMSucc)succ fail:(TIMFail)fail;
235 300
236 -#pragma mark - 登录多账号 301 +/// @}
237 302
  303 +/////////////////////////////////////////////////////////////////////////////////
  304 +//
  305 +// (七)多账号登录接口
  306 +//
  307 +/////////////////////////////////////////////////////////////////////////////////
  308 +///@name 多账号登录接口
  309 +/// @{
238 /** 310 /**
239 - * 创建新的管理器类型(多用户登陆时使用,否则可直接调用sharedInstance) 311 + * 创建新的管理器类型(多用户登陆时使用,否则可直接调用 sharedInstance)
240 * 312 *
241 * @return 管理器实例 313 * @return 管理器实例
242 */ 314 */
243 + (TIMManager*)newManager; 315 + (TIMManager*)newManager;
244 316
245 /** 317 /**
246 - * 获取管理器类型(多用户登陆时使用,否则可直接调用sharedInstance) 318 + * 获取管理器类型(多用户登陆时使用,否则可直接调用 sharedInstance)
247 * 319 *
248 - * @param identifier 用户identifier 320 + * @param identifier 用户 identifier
249 * 321 *
250 - * @return 对应管理器类型,如果没有创建过,返回nil 322 + * @return 对应管理器类型,如果没有创建过,返回 nil
251 */ 323 */
252 + (TIMManager*)getManager:(NSString*)identifier; 324 + (TIMManager*)getManager:(NSString*)identifier;
253 325
254 /** 326 /**
255 - * 销毁管理器(多用户登陆时使用,否则可直接调用sharedInstance) 327 + * 销毁管理器(多用户登陆时使用,否则可直接调用 sharedInstance)
256 * 328 *
257 * @param manager 需要销毁的管理器 329 * @param manager 需要销毁的管理器
258 */ 330 */
259 + (void)deleteManager:(TIMManager*)manager; 331 + (void)deleteManager:(TIMManager*)manager;
260 332
  333 +/// @}
  334 +
  335 +/////////////////////////////////////////////////////////////////////////////////
  336 +//
  337 +// (八)调试相关接口
  338 +//
  339 +/////////////////////////////////////////////////////////////////////////////////
  340 +/// @name 调试相关接口
  341 +/// @{
261 /** 342 /**
262 - * 获取好友管理器 343 + * 获取版本号
263 * 344 *
264 - * @return 好友管理器 345 + * @return 返回版本号,字符串表示,例如 v1.1.1
265 */ 346 */
266 -//- (TIMFriendshipManager*)friendshipManager; 347 +- (NSString*)GetVersion;
267 348
268 /** 349 /**
269 - * 获取群管理器 350 + * 打印日志,通过 ImSDK 提供的日志功能打印日志
270 * 351 *
271 - * @return 群管理器 352 + * @param level 日志级别,详情请参考 TIMComm.h 中的 TIMLogLevel 定义
  353 + * @param tag 模块 tag
  354 + * @param msg 要输出的日志内容
272 */ 355 */
273 -- (TIMGroupManager*)groupManager;  
274 -  
275 -#pragma mark - 内部使用的方法 356 +- (void)log:(TIMLogLevel)level tag:(NSString*)tag msg:(NSString*)msg;
276 357
277 /** 358 /**
278 * 获取日志文件路径 359 * 获取日志文件路径
@@ -280,15 +361,25 @@ @@ -280,15 +361,25 @@
280 - (NSString*)getLogPath; 361 - (NSString*)getLogPath;
281 362
282 /** 363 /**
283 - * 是否开启sdk日志打印 364 + * 是否开启 sdk 日志打印
  365 + *
  366 + * @return YES:允许 log 打印;NO:不允许 log 打印
284 */ 367 */
285 - (BOOL)getIsLogPrintEnabled; 368 - (BOOL)getIsLogPrintEnabled;
286 369
287 /** 370 /**
288 * 获取日志级别 371 * 获取日志级别
289 * 372 *
290 - * @return 返回日志级别 373 + * @return 返回日志级别,详情请参考 TIMComm.h 中的 TIMLogLevel 定义
291 */ 374 */
292 -(TIMLogLevel) getLogLevel; 375 -(TIMLogLevel) getLogLevel;
  376 +
  377 +/**
  378 + * 重置ImSDK配置信息,内部自动化测试使用
  379 + */
  380 +- (void)unInit;
  381 +
  382 +///@}
  383 +
293 @end 384 @end
294 #endif 385 #endif
@@ -9,14 +9,18 @@ @@ -9,14 +9,18 @@
9 #ifndef TIMMessage_h 9 #ifndef TIMMessage_h
10 #define TIMMessage_h 10 #define TIMMessage_h
11 11
12 -#import "ImSDK.h" 12 +#import "TIMMessage.h"
13 #import "TIMComm+MsgExt.h" 13 #import "TIMComm+MsgExt.h"
14 14
15 #pragma mark - Elem类型 15 #pragma mark - Elem类型
16 16
17 -/**  
18 - * 关系链变更消息  
19 - */ 17 +/////////////////////////////////////////////////////////////////////////////////
  18 +//
  19 +// (一)关系链变更消息
  20 +//
  21 +/////////////////////////////////////////////////////////////////////////////////
  22 +/// @name 关系链变更消息
  23 +/// @{
20 @interface TIMSNSSystemElem : TIMElem 24 @interface TIMSNSSystemElem : TIMElem
21 25
22 /** 26 /**
@@ -30,25 +34,31 @@ @@ -30,25 +34,31 @@
30 @property(nonatomic,strong) NSArray * users; 34 @property(nonatomic,strong) NSArray * users;
31 35
32 /** 36 /**
33 - * 未决已读上报时间戳 type=TIM_SNS_SYSTEM_PENDENCY_REPORT 有效 37 + * 未决已读上报时间戳 type = TIM_SNS_SYSTEM_PENDENCY_REPORT 有效
34 */ 38 */
35 @property(nonatomic,assign) uint64_t pendencyReportTimestamp; 39 @property(nonatomic,assign) uint64_t pendencyReportTimestamp;
36 40
37 /** 41 /**
38 - * 推荐已读上报时间戳 type=TIM_SNS_SYSTEM_RECOMMEND_REPORT 有效 42 + * 推荐已读上报时间戳 type = TIM_SNS_SYSTEM_RECOMMEND_REPORT 有效
39 */ 43 */
40 @property(nonatomic,assign) uint64_t recommendReportTimestamp; 44 @property(nonatomic,assign) uint64_t recommendReportTimestamp;
41 45
42 /** 46 /**
43 - * 已决已读上报时间戳 type=TIM_SNS_SYSTEM_DECIDE_REPORT 有效 47 + * 已决已读上报时间戳 type = TIM_SNS_SYSTEM_DECIDE_REPORT 有效
44 */ 48 */
45 @property(nonatomic,assign) uint64_t decideReportTimestamp; 49 @property(nonatomic,assign) uint64_t decideReportTimestamp;
46 50
47 @end 51 @end
48 52
49 -/**  
50 - * 资料变更系统消息  
51 - */ 53 +/// @}
  54 +
  55 +/////////////////////////////////////////////////////////////////////////////////
  56 +//
  57 +// (二)资料变更消息
  58 +//
  59 +/////////////////////////////////////////////////////////////////////////////////
  60 +/// @name 资料变更消息
  61 +/// @{
52 @interface TIMProfileSystemElem : TIMElem 62 @interface TIMProfileSystemElem : TIMElem
53 63
54 /** 64 /**
@@ -62,72 +72,78 @@ @@ -62,72 +72,78 @@
62 @property(nonatomic,strong) NSString * fromUser; 72 @property(nonatomic,strong) NSString * fromUser;
63 73
64 /** 74 /**
65 - * 资料变更的昵称(如果昵称没有变更,该值为nil 75 + * 资料变更的昵称(暂未实现
66 */ 76 */
67 @property(nonatomic,strong) NSString * nickName; 77 @property(nonatomic,strong) NSString * nickName;
68 78
69 @end 79 @end
70 80
71 -#pragma mark - 消息扩展 81 +/// @}
72 82
  83 +/////////////////////////////////////////////////////////////////////////////////
  84 +//
  85 +// (三)消息扩展接口
  86 +//
  87 +/////////////////////////////////////////////////////////////////////////////////
  88 +/// @name 消息扩展接口
  89 +/// @{
73 @interface TIMMessage (MsgExt) 90 @interface TIMMessage (MsgExt)
74 91
75 /** 92 /**
76 - * 是否已读 93 + * 自己是否已读
77 * 94 *
78 - * @return TRUE 已读 FALSE 未读 95 + * @return TRUE:已读;FALSE:未读
79 */ 96 */
80 - (BOOL)isReaded; 97 - (BOOL)isReaded;
81 98
82 /** 99 /**
83 - * 对方是否已读(仅C2C消息有效) 100 + * 对方是否已读(仅 C2C 消息有效)
84 * 101 *
85 - * @return TRUE 已读 FALSE 未读 102 + * @return TRUE:已读;FALSE:未读
86 */ 103 */
87 - (BOOL)isPeerReaded; 104 - (BOOL)isPeerReaded;
88 105
89 /** 106 /**
90 * 删除消息 107 * 删除消息
91 * 108 *
92 - * @return TRUE 成功 109 + * 目前暂不支持 Server 消息删除,只能在本地删除。删除后使用 getMessage 拉取本地消息,不会返回被删除的消息。
  110 + *
  111 + * @return TRUE:成功;FALSE:失败
93 */ 112 */
94 - (BOOL)remove; 113 - (BOOL)remove;
95 114
96 /** 115 /**
97 - * 消息有断层,OnNewMessage回调收到消息,如果有断层,需要重新GetMessage补全(有C2C漫游的情况下使用) 116 + * 设置自定义整数,默认为 0
98 * 117 *
99 - * @return TRUE 有断层  
100 - * FALSE 无断层  
101 - */  
102 -- (BOOL)hasGap;  
103 -  
104 -/**  
105 - * 设置自定义整数,默认为0 118 + * 1.此自定义字段仅存储于本地,不会同步到 Server,用户卸载应用或则更换终端后无法获取。
  119 + * 2.可以根据这个字段设置语音消息是否已经播放,如 customInt 的值 0 表示未播放,1 表示播放,当用户单击播放后可设置 customInt 的值为 1。
106 * 120 *
107 * @param param 设置参数 121 * @param param 设置参数
108 * 122 *
109 - * @return TRUE 设置成功 123 + * @return TRUE:设置成功;FALSE:设置失败
110 */ 124 */
111 - (BOOL)setCustomInt:(int32_t)param; 125 - (BOOL)setCustomInt:(int32_t)param;
112 126
113 /** 127 /**
114 * 设置自定义数据,默认为"" 128 * 设置自定义数据,默认为""
115 * 129 *
  130 + * 此自定义字段仅存储于本地,不会同步到 Server,用户卸载应用或则更换终端后无法获取。
  131 + *
116 * @param data 设置参数 132 * @param data 设置参数
117 * 133 *
118 - * @return TRUE 设置成功 134 + * @return TRUE:设置成功;FALSE:设置失败
119 */ 135 */
120 - (BOOL)setCustomData:(NSData*)data; 136 - (BOOL)setCustomData:(NSData*)data;
121 137
122 /** 138 /**
123 - * 获取CustomInt 139 + * 获取 CustomInt
124 * 140 *
125 * @return CustomInt 141 * @return CustomInt
126 */ 142 */
127 - (int32_t)customInt; 143 - (int32_t)customInt;
128 144
129 /** 145 /**
130 - * 获取CustomData 146 + * 获取 CustomData
131 * 147 *
132 * @return CustomData 148 * @return CustomData
133 */ 149 */
@@ -136,12 +152,14 @@ @@ -136,12 +152,14 @@
136 /** 152 /**
137 * 获取消息定位符 153 * 获取消息定位符
138 * 154 *
139 - * @return locator 155 + * 如果是自己创建的 TIMMessage,需要等到消息发送成功后才能获取到 TIMMessageLocator 里面的具体信息
  156 + *
  157 + * @return locator,详情请参考 TIMComm.h 里面的 TIMMessageLocator 定义
140 */ 158 */
141 - (TIMMessageLocator*)locator; 159 - (TIMMessageLocator*)locator;
142 160
143 /** 161 /**
144 - * 是否为locator对应的消息 162 + * 是否为 locator 对应的消息
145 * 163 *
146 * @param locator 消息定位符 164 * @param locator 消息定位符
147 * 165 *
@@ -150,35 +168,47 @@ @@ -150,35 +168,47 @@
150 - (BOOL)respondsToLocator:(TIMMessageLocator*)locator; 168 - (BOOL)respondsToLocator:(TIMMessageLocator*)locator;
151 169
152 /** 170 /**
153 - * 设置消息时间戳,导入到本地时有效 171 + * 设置消息时间戳
  172 + *
  173 + * 需要先将消息到导入到本地,调用 convertToImportedMsg 方法
154 * 174 *
155 * @param time 时间戳 175 * @param time 时间戳
156 * 176 *
157 - * @return 0 成功 177 + * @return 0:成功;1:失败
158 */ 178 */
159 - (int)setTime:(time_t)time; 179 - (int)setTime:(time_t)time;
160 180
161 /** 181 /**
162 - * 设置消息发送方(需要先将消息到导入到本地,调用 convertToImportedMsg 方法)  
163 - 182 + * 设置消息发送方
  183 + *
  184 + * 需要先将消息到导入到本地,调用 convertToImportedMsg 方法
164 * 185 *
165 * @param sender 发送方Id 186 * @param sender 发送方Id
166 * 187 *
167 - * @return 0 成功 188 + * @return 0:成功;1:失败
168 */ 189 */
169 - (int)setSender:(NSString*)sender; 190 - (int)setSender:(NSString*)sender;
170 191
171 /** 192 /**
172 * 将消息导入到本地 193 * 将消息导入到本地
173 * 194 *
174 - * @return 0 成功 195 + * 只有调用这个接口,才能去修改消息的时间戳和发送方
  196 + *
  197 + * @return 0:成功;1:失败
175 */ 198 */
176 - (int)convertToImportedMsg; 199 - (int)convertToImportedMsg;
177 200
178 -@end 201 +/// @}
179 202
180 -#pragma mark - 消息草稿 203 +@end
181 204
  205 +/////////////////////////////////////////////////////////////////////////////////
  206 +//
  207 +// (四)草稿箱
  208 +//
  209 +/////////////////////////////////////////////////////////////////////////////////
  210 +/// @name 草稿箱
  211 +/// @{
182 @interface TIMMessageDraft : NSObject 212 @interface TIMMessageDraft : NSObject
183 213
184 /** 214 /**
@@ -186,7 +216,7 @@ @@ -186,7 +216,7 @@
186 * 216 *
187 * @param userData 自定义数据 217 * @param userData 自定义数据
188 * 218 *
189 - * @return 0 成功 219 + * @return 0:成功;1:失败
190 */ 220 */
191 - (int)setUserData:(NSData*)userData; 221 - (int)setUserData:(NSData*)userData;
192 222
@@ -202,18 +232,17 @@ @@ -202,18 +232,17 @@
202 * 232 *
203 * @param elem elem结构 233 * @param elem elem结构
204 * 234 *
205 - * @return 0 表示成功  
206 - * 1 禁止添加Elem(文件或语音多于两个Elem)  
207 - * 2 未知Elem 235 + * @return 0:表示成功;1:禁止添加Elem(文件或语音多于两个Elem);2:未知Elem
  236 + *
208 */ 237 */
209 - (int)addElem:(TIMElem*)elem; 238 - (int)addElem:(TIMElem*)elem;
210 239
211 /** 240 /**
212 - * 获取对应索引的Elem 241 + * 获取对应索引的 Elem
213 * 242 *
214 * @param index 对应索引 243 * @param index 对应索引
215 * 244 *
216 - * @return 返回对应Elem 245 + * @return 返回对应 Elem
217 */ 246 */
218 - (TIMElem*)getElem:(int)index; 247 - (TIMElem*)getElem:(int)index;
219 248
@@ -227,7 +256,7 @@ @@ -227,7 +256,7 @@
227 /** 256 /**
228 * 草稿生成对应的消息 257 * 草稿生成对应的消息
229 * 258 *
230 - * @return 消息 259 + * @return 消息,详情请参考 TIMMessage.h 里面的 TIMMessage 定义
231 */ 260 */
232 - (TIMMessage*)transformToMessage; 261 - (TIMMessage*)transformToMessage;
233 262
@@ -238,6 +267,8 @@ @@ -238,6 +267,8 @@
238 */ 267 */
239 - (NSDate*)timestamp; 268 - (NSDate*)timestamp;
240 269
  270 +/// @}
  271 +
241 @end 272 @end
242 273
243 #endif /* TIMMessage_h */ 274 #endif /* TIMMessage_h */
@@ -18,15 +18,29 @@ @@ -18,15 +18,29 @@
18 @class TIMUserProfile; 18 @class TIMUserProfile;
19 @class TIMGroupMemberInfo; 19 @class TIMGroupMemberInfo;
20 @class TIMConversation; 20 @class TIMConversation;
  21 +@class TIMSnapshot;
21 22
  23 +/////////////////////////////////////////////////////////////////////////////////
  24 +//
  25 +// (一)消息基类
  26 +//
  27 +/////////////////////////////////////////////////////////////////////////////////
  28 +/// @name 消息基类
22 /** 29 /**
23 - * 消息Elem基类 30 + * 消息 Elem 基类
24 */ 31 */
25 @interface TIMElem : NSObject 32 @interface TIMElem : NSObject
26 @end 33 @end
  34 +/// @}
27 35
  36 +/////////////////////////////////////////////////////////////////////////////////
  37 +//
  38 +// (二)文本消息
  39 +//
  40 +/////////////////////////////////////////////////////////////////////////////////
  41 +/// @name 文本消息
28 /** 42 /**
29 - * 文本消息Elem 43 + * 文本消息 Elem
30 */ 44 */
31 @interface TIMTextElem : TIMElem 45 @interface TIMTextElem : TIMElem
32 /** 46 /**
@@ -34,12 +48,20 @@ @@ -34,12 +48,20 @@
34 */ 48 */
35 @property(nonatomic,strong) NSString * text; 49 @property(nonatomic,strong) NSString * text;
36 @end 50 @end
  51 +/// @}
37 52
38 -#pragma mark - 普通消息类型  
39 - 53 +/////////////////////////////////////////////////////////////////////////////////
  54 +//
  55 +// (三)图片消息
  56 +//
  57 +/////////////////////////////////////////////////////////////////////////////////
  58 +/// @name 图片消息
  59 +/**
  60 + * 图片
  61 + */
40 @interface TIMImage : NSObject 62 @interface TIMImage : NSObject
41 /** 63 /**
42 - * 图片ID,内部标识,可用于外部缓存key 64 + * 图片 ID,内部标识,可用于外部缓存key
43 */ 65 */
44 @property(nonatomic,strong) NSString * uuid; 66 @property(nonatomic,strong) NSString * uuid;
45 /** 67 /**
@@ -66,16 +88,28 @@ @@ -66,16 +88,28 @@
66 /** 88 /**
67 * 获取图片 89 * 获取图片
68 * 90 *
  91 + * 下载的数据需要由开发者缓存,IM SDK 每次调用 getImage 都会从服务端重新下载数据。建议通过图片的 uuid 作为 key 进行图片文件的存储。
  92 + *
69 * @param path 图片保存路径 93 * @param path 图片保存路径
70 * @param succ 成功回调,返回图片数据 94 * @param succ 成功回调,返回图片数据
71 * @param fail 失败回调,返回错误码和错误描述 95 * @param fail 失败回调,返回错误码和错误描述
72 */ 96 */
73 - (void)getImage:(NSString*)path succ:(TIMSucc)succ fail:(TIMFail)fail; 97 - (void)getImage:(NSString*)path succ:(TIMSucc)succ fail:(TIMFail)fail;
  98 +
  99 +/**
  100 + * 获取图片(有进度回调)
  101 + *
  102 + * 下载的数据需要由开发者缓存,IM SDK 每次调用 getImage 都会从服务端重新下载数据。建议通过图片的 uuid 作为 key 进行图片文件的存储。
  103 + *
  104 + * @param path 图片保存路径
  105 + * @param progress 图片下载进度
  106 + * @param succ 成功回调,返回图片数据
  107 + * @param fail 失败回调,返回错误码和错误描述
  108 + */
74 - (void)getImage:(NSString*)path progress:(TIMProgress)progress succ:(TIMSucc)succ fail:(TIMFail)fail; 109 - (void)getImage:(NSString*)path progress:(TIMProgress)progress succ:(TIMSucc)succ fail:(TIMFail)fail;
75 110
76 @end 111 @end
77 112
78 -  
79 /** 113 /**
80 * 图片消息Elem 114 * 图片消息Elem
81 */ 115 */
@@ -87,17 +121,17 @@ @@ -87,17 +121,17 @@
87 @property(nonatomic,strong) NSString * path; 121 @property(nonatomic,strong) NSString * path;
88 122
89 /** 123 /**
90 - * 所有类型图片,只读 124 + * 所有类型图片,只读,发送的时候不用关注,接收的时候这个字段会保存图片的所有规格,目前最多包含三种规格:原图、大图、缩略图,每种规格保存在一个 TIMImage 对象中
91 */ 125 */
92 @property(nonatomic,strong) NSArray * imageList; 126 @property(nonatomic,strong) NSArray * imageList;
93 127
94 /** 128 /**
95 - * 上传时任务Id,可用来查询上传进度 129 + * 上传时任务 ID,可用来查询上传进度(已废弃,请在 TIMUploadProgressListener 监听上传进度)
96 */ 130 */
97 -@property(nonatomic,assign) uint32_t taskId; 131 +@property(nonatomic,assign) uint32_t taskId DEPRECATED_ATTRIBUTE;
98 132
99 /** 133 /**
100 - * 图片压缩等级,详见 TIM_IMAGE_COMPRESS_TYPE(仅对jpg格式有效) 134 + * 图片压缩等级,详见 TIM_IMAGE_COMPRESS_TYPE(仅对 jpg 格式有效)
101 */ 135 */
102 @property(nonatomic,assign) TIM_IMAGE_COMPRESS_TYPE level; 136 @property(nonatomic,assign) TIM_IMAGE_COMPRESS_TYPE level;
103 137
@@ -108,124 +142,224 @@ @@ -108,124 +142,224 @@
108 142
109 @end 143 @end
110 144
  145 +/// @}
  146 +
  147 +/////////////////////////////////////////////////////////////////////////////////
  148 +//
  149 +// (四)语音消息
  150 +//
  151 +/////////////////////////////////////////////////////////////////////////////////
  152 +/// @name 语音消息
111 /** 153 /**
112 - * 文件消息Elem 154 + * 语音消息Elem
  155 + *
  156 + * 1. 一条消息只能有一个语音 Elem,添加多条语音 Elem 时,AddElem 函数返回错误 1,添加不生效。
  157 + * 2. 语音和文件 Elem 不一定会按照添加时的顺序获取,建议逐个判断 Elem 类型展示,而且语音和文件 Elem 也不保证按照发送的 Elem 顺序排序。
  158 + *
113 */ 159 */
114 -@interface TIMFileElem : TIMElem 160 +@interface TIMSoundElem : TIMElem
115 /** 161 /**
116 - * 上传时任务Id,可用来查询上传进度 162 + * 上传时任务 ID,可用来查询上传进度(已废弃,请在 TIMUploadProgressListener 监听上传进度)
117 */ 163 */
118 -@property(nonatomic,assign) uint32_t taskId; 164 +@property(nonatomic,assign) uint32_t taskId DEPRECATED_ATTRIBUTE;
119 /** 165 /**
120 - * 上传时,文件的路径(设置path时,优先上传文件) 166 + * 上传时,语音文件的路径,接收时使用 getSound 获得数据
121 */ 167 */
122 @property(nonatomic,strong) NSString * path; 168 @property(nonatomic,strong) NSString * path;
123 /** 169 /**
124 - * 文件内部ID 170 + * 语音消息内部 ID
125 */ 171 */
126 @property(nonatomic,strong) NSString * uuid; 172 @property(nonatomic,strong) NSString * uuid;
127 /** 173 /**
128 - * 文件大小 174 + * 语音数据大小
129 */ 175 */
130 -@property(nonatomic,assign) int fileSize; 176 +@property(nonatomic,assign) int dataSize;
131 /** 177 /**
132 - * 文件显示名,发消息时设置 178 + * 语音长度(秒),发送消息时设置
133 */ 179 */
134 -@property(nonatomic,strong) NSString * filename; 180 +@property(nonatomic,assign) int second;
135 181
136 /** 182 /**
137 - * 获取文件数据到指定路径的文件中 183 + * 获取语音数据到指定路径的文件中
138 * 184 *
139 - * @param path 文件保存路径  
140 - * @param succ 成功回调,返回数据 185 + * getSound 接口每次都会从服务端下载,如需缓存或者存储,开发者可根据 uuid 作为 key 进行外部存储,ImSDK 并不会存储资源文件。
  186 + *
  187 + * @param path 语音保存路径
  188 + * @param succ 成功回调
141 * @param fail 失败回调,返回错误码和错误描述 189 * @param fail 失败回调,返回错误码和错误描述
142 */ 190 */
143 -- (void)getFile:(NSString*)path succ:(TIMSucc)succ fail:(TIMFail)fail;  
144 -- (void)getFile:(NSString*)path progress:(TIMProgress)progress succ:(TIMSucc)succ fail:(TIMFail)fail; 191 +- (void)getSound:(NSString*)path succ:(TIMSucc)succ fail:(TIMFail)fail;
  192 +
  193 +/**
  194 + * 获取语音数据到指定路径的文件中(有进度回调)
  195 + *
  196 + * getSound 接口每次都会从服务端下载,如需缓存或者存储,开发者可根据 uuid 作为 key 进行外部存储,ImSDK 并不会存储资源文件。
  197 + *
  198 + * @param path 语音保存路径
  199 + * @param progress 语音下载进度
  200 + * @param succ 成功回调
  201 + * @param fail 失败回调,返回错误码和错误描述
  202 + */
  203 +- (void)getSound:(NSString*)path progress:(TIMProgress)progress succ:(TIMSucc)succ fail:(TIMFail)fail;
145 204
146 @end 205 @end
147 206
  207 +/// @}
  208 +
  209 +/////////////////////////////////////////////////////////////////////////////////
  210 +//
  211 +// (五)视频消息
  212 +//
  213 +/////////////////////////////////////////////////////////////////////////////////
  214 +/// @name 视频消息
148 /** 215 /**
149 - * 语音消息Elem 216 + * 视频
150 */ 217 */
151 -@interface TIMSoundElem : TIMElem 218 +@interface TIMVideo : NSObject
152 /** 219 /**
153 - * 上传时任务Id,可用来查询上传进度 220 + * 视频消息内部 ID,不用设置
154 */ 221 */
155 -@property(nonatomic,assign) uint32_t taskId; 222 +@property(nonatomic,strong) NSString * uuid;
156 /** 223 /**
157 - * 上传时,语音文件的路径,接收时使用getSound获得数据 224 + * 视频文件类型,发送消息时设置
158 */ 225 */
159 -@property(nonatomic,strong) NSString * path; 226 +@property(nonatomic,strong) NSString * type;
160 /** 227 /**
161 - * 语音消息内部ID 228 + * 视频大小,不用设置
162 */ 229 */
163 -@property(nonatomic,strong) NSString * uuid; 230 +@property(nonatomic,assign) int size;
164 /** 231 /**
165 - * 语音数据大小 232 + * 视频时长,发送消息时设置
166 */ 233 */
167 -@property(nonatomic,assign) int dataSize; 234 +@property(nonatomic,assign) int duration;
  235 +
168 /** 236 /**
169 - * 语音长度(秒),发送消息时设置 237 + * 获取视频
  238 + *
  239 + * getVideo 接口每次都会从服务端下载,如需缓存或者存储,开发者可根据 uuid 作为 key 进行外部存储,ImSDK 并不会存储资源文件。
  240 + *
  241 + * @param path 视频保存路径
  242 + * @param succ 成功回调
  243 + * @param fail 失败回调,返回错误码和错误描述
170 */ 244 */
171 -@property(nonatomic,assign) int second; 245 +- (void)getVideo:(NSString*)path succ:(TIMSucc)succ fail:(TIMFail)fail;
172 246
173 /** 247 /**
174 - * 获取语音数据到指定路径的文件中 248 + * 获取视频(有进度回调)
175 * 249 *
176 - * @param path 语音保存路径 250 + * getVideo 接口每次都会从服务端下载,如需缓存或者存储,开发者可根据 uuid 作为 key 进行外部存储,ImSDK 并不会存储资源文件。
  251 + *
  252 + * @param path 视频保存路径
  253 + * @param progress 视频下载进度
177 * @param succ 成功回调 254 * @param succ 成功回调
178 * @param fail 失败回调,返回错误码和错误描述 255 * @param fail 失败回调,返回错误码和错误描述
179 */ 256 */
180 -- (void)getSound:(NSString*)path succ:(TIMSucc)succ fail:(TIMFail)fail;  
181 -- (void)getSound:(NSString*)path progress:(TIMProgress)progress succ:(TIMSucc)succ fail:(TIMFail)fail;  
182 - 257 +- (void)getVideo:(NSString*)path progress:(TIMProgress)progress succ:(TIMSucc)succ fail:(TIMFail)fail;
183 @end 258 @end
184 259
185 /** 260 /**
186 - * 地理位置Elem 261 + * 视频消息 Elem
187 */ 262 */
188 -@interface TIMLocationElem : TIMElem 263 +@interface TIMVideoElem : TIMElem
  264 +
189 /** 265 /**
190 - * 地理位置描述信息,发送消息时设置 266 + * 上传时任务 ID,可用来查询上传进度(已废弃,请在 TIMUploadProgressListener 监听上传进度)
191 */ 267 */
192 -@property(nonatomic,strong) NSString * desc; 268 +@property(nonatomic,assign) uint32_t taskId DEPRECATED_ATTRIBUTE;
  269 +
193 /** 270 /**
194 - * 纬度,发送消息时设置 271 + * 视频文件路径,发送消息时设置
195 */ 272 */
196 -@property(nonatomic,assign) double latitude; 273 +@property(nonatomic,strong) NSString * videoPath;
  274 +
197 /** 275 /**
198 - * 经度,发送消息时设置 276 + * 视频信息,发送消息时设置
199 */ 277 */
200 -@property(nonatomic,assign) double longitude;  
201 -@end 278 +@property(nonatomic,strong) TIMVideo * video;
202 279
  280 +/**
  281 + * 截图文件路径,发送消息时设置
  282 + */
  283 +@property(nonatomic,strong) NSString * snapshotPath;
203 284
204 /** 285 /**
205 - * 自定义消息类型 286 + * 视频截图,发送消息时设置
206 */ 287 */
207 -@interface TIMCustomElem : TIMElem 288 +@property(nonatomic,strong) TIMSnapshot * snapshot;
  289 +
  290 +@end
  291 +
  292 +/// @}
208 293
  294 +/////////////////////////////////////////////////////////////////////////////////
  295 +//
  296 +// (六)文件消息
  297 +//
  298 +/////////////////////////////////////////////////////////////////////////////////
  299 +/// @name 文件消息
209 /** 300 /**
210 - * 自定义消息二进制数据 301 + * 文件消息Elem
211 */ 302 */
212 -@property(nonatomic,strong) NSData * data; 303 +@interface TIMFileElem : TIMElem
213 /** 304 /**
214 - * 自定义消息描述信息,做离线Push时文本展示(已废弃,请使用TIMMessage中offlinePushInfo进行配置 305 + * 上传时任务 ID,可用来查询上传进度(已废弃,请在 TIMUploadProgressListener 监听上传进度
215 */ 306 */
216 -@property(nonatomic,strong) NSString * desc DEPRECATED_ATTRIBUTE; 307 +@property(nonatomic,assign) uint32_t taskId DEPRECATED_ATTRIBUTE;
217 /** 308 /**
218 - * 离线Push时扩展字段信息(已废弃,请使用TIMMessage中offlinePushInfo进行配置 309 + * 上传时,文件的路径(设置 path 时,优先上传文件
219 */ 310 */
220 -@property(nonatomic,strong) NSString * ext DEPRECATED_ATTRIBUTE; 311 +@property(nonatomic,strong) NSString * path;
221 /** 312 /**
222 - * 离线Push时声音字段信息(已废弃,请使用TIMMessage中offlinePushInfo进行配置) 313 + * 文件内部 ID
223 */ 314 */
224 -@property(nonatomic,strong) NSString * sound DEPRECATED_ATTRIBUTE; 315 +@property(nonatomic,strong) NSString * uuid;
  316 +/**
  317 + * 文件大小
  318 + */
  319 +@property(nonatomic,assign) int fileSize;
  320 +/**
  321 + * 文件显示名,发消息时设置
  322 + */
  323 +@property(nonatomic,strong) NSString * filename;
  324 +
  325 +/**
  326 + * 获取文件数据到指定路径的文件中
  327 + *
  328 + * getFile 接口每次都会从服务端下载,如需缓存或者存储,开发者可根据 uuid 作为 key 进行外部存储,ImSDK 并不会存储资源文件。
  329 + *
  330 + * @param path 文件保存路径
  331 + * @param succ 成功回调,返回数据
  332 + * @param fail 失败回调,返回错误码和错误描述
  333 + */
  334 +- (void)getFile:(NSString*)path succ:(TIMSucc)succ fail:(TIMFail)fail;
  335 +
  336 +/**
  337 + * 获取文件数据到指定路径的文件中(有进度回调)
  338 + *
  339 + * getFile 接口每次都会从服务端下载,如需缓存或者存储,开发者可根据 uuid 作为 key 进行外部存储,ImSDK 并不会存储资源文件。
  340 + *
  341 + * @param path 文件保存路径
  342 + * @param progress 文件下载进度
  343 + * @param succ 成功回调,返回数据
  344 + * @param fail 失败回调,返回错误码和错误描述
  345 + */
  346 +- (void)getFile:(NSString*)path progress:(TIMProgress)progress succ:(TIMSucc)succ fail:(TIMFail)fail;
  347 +
225 @end 348 @end
226 349
  350 +/// @}
  351 +
  352 +/////////////////////////////////////////////////////////////////////////////////
  353 +//
  354 +// (七)表情消息
  355 +//
  356 +/////////////////////////////////////////////////////////////////////////////////
227 /** 357 /**
228 * 表情消息类型 358 * 表情消息类型
  359 + *
  360 + * 1. 表情消息由 TIMFaceElem 定义,SDK 并不提供表情包,如果开发者有表情包,可使用 index 存储表情在表情包中的索引,由用户自定义,或者直接使用 data 存储表情二进制信息以及字符串 key,都由用户自定义,SDK 内部只做透传。
  361 + * 2. index 和 data 只需要传入一个即可,ImSDK 只是透传这两个数据。
  362 + *
229 */ 363 */
230 @interface TIMFaceElem : TIMElem 364 @interface TIMFaceElem : TIMElem
231 365
@@ -240,39 +374,40 @@ @@ -240,39 +374,40 @@
240 374
241 @end 375 @end
242 376
243 -@interface TIMVideo : NSObject 377 +/////////////////////////////////////////////////////////////////////////////////
  378 +//
  379 +// (八)地理位置消息
  380 +//
  381 +/////////////////////////////////////////////////////////////////////////////////
244 /** 382 /**
245 - * 视频ID,不用设置 383 + * 地理位置Elem
246 */ 384 */
247 -@property(nonatomic,strong) NSString * uuid; 385 +@interface TIMLocationElem : TIMElem
248 /** 386 /**
249 - * 视频文件类型,发送消息时设置 387 + * 地理位置描述信息,发送消息时设置
250 */ 388 */
251 -@property(nonatomic,strong) NSString * type; 389 +@property(nonatomic,strong) NSString * desc;
252 /** 390 /**
253 - * 视频大小,不用设置 391 + * 纬度,发送消息时设置
254 */ 392 */
255 -@property(nonatomic,assign) int size; 393 +@property(nonatomic,assign) double latitude;
256 /** 394 /**
257 - * 视频时长,发送消息时设置 395 + * 经度,发送消息时设置
258 */ 396 */
259 -@property(nonatomic,assign) int duration; 397 +@property(nonatomic,assign) double longitude;
  398 +@end
260 399
  400 +/////////////////////////////////////////////////////////////////////////////////
  401 +//
  402 +// (九)截图消息
  403 +//
  404 +/////////////////////////////////////////////////////////////////////////////////
261 /** 405 /**
262 - * 获取视频  
263 - *  
264 - * @param path 视频保存路径  
265 - * @param succ 成功回调  
266 - * @param fail 失败回调,返回错误码和错误描述 406 + * 截图消息 Elem
267 */ 407 */
268 -- (void)getVideo:(NSString*)path succ:(TIMSucc)succ fail:(TIMFail)fail;  
269 -- (void)getVideo:(NSString*)path progress:(TIMProgress)progress succ:(TIMSucc)succ fail:(TIMFail)fail;  
270 -@end  
271 -  
272 -  
273 @interface TIMSnapshot : NSObject 408 @interface TIMSnapshot : NSObject
274 /** 409 /**
275 - * 图片ID,不用设置 410 + * 图片 ID,不用设置
276 */ 411 */
277 @property(nonatomic,strong) NSString * uuid; 412 @property(nonatomic,strong) NSString * uuid;
278 /** 413 /**
@@ -295,48 +430,64 @@ @@ -295,48 +430,64 @@
295 /** 430 /**
296 * 获取图片 431 * 获取图片
297 * 432 *
  433 + * getImage 接口每次都会从服务端下载,如需缓存或者存储,开发者可根据 uuid 作为 key 进行外部存储,ImSDK 并不会存储资源文件。
  434 + *
298 * @param path 图片保存路径 435 * @param path 图片保存路径
299 * @param succ 成功回调,返回图片数据 436 * @param succ 成功回调,返回图片数据
300 * @param fail 失败回调,返回错误码和错误描述 437 * @param fail 失败回调,返回错误码和错误描述
301 */ 438 */
302 - (void)getImage:(NSString*)path succ:(TIMSucc)succ fail:(TIMFail)fail; 439 - (void)getImage:(NSString*)path succ:(TIMSucc)succ fail:(TIMFail)fail;
303 -- (void)getImage:(NSString*)path progress:(TIMProgress)progress succ:(TIMSucc)succ fail:(TIMFail)fail;  
304 -  
305 -@end  
306 440
307 /** 441 /**
308 - * 微视频消息 442 + * 获取图片(有进度回调)
  443 + *
  444 + * getImage 接口每次都会从服务端下载,如需缓存或者存储,开发者可根据 uuid 作为 key 进行外部存储,ImSDK 并不会存储资源文件。
  445 + *
  446 + * @param path 图片保存路径
  447 + * @param progress 图片下载进度
  448 + * @param succ 成功回调,返回图片数据
  449 + * @param fail 失败回调,返回错误码和错误描述
309 */ 450 */
310 -@interface TIMVideoElem : TIMElem 451 +- (void)getImage:(NSString*)path progress:(TIMProgress)progress succ:(TIMSucc)succ fail:(TIMFail)fail;
  452 +
  453 +@end
311 454
  455 +/////////////////////////////////////////////////////////////////////////////////
  456 +//
  457 +// (十)自定义消息
  458 +//
  459 +/////////////////////////////////////////////////////////////////////////////////
312 /** 460 /**
313 - * 上传时任务Id,可用来查询上传进度 461 + * 自定义消息类型
  462 + *
  463 + * 自定义消息是指当内置的消息类型无法满足特殊需求,开发者可以自定义消息格式,内容全部由开发者定义,IM SDK 只负责透传。自定义消息由 TIMCustomElem 定义,其中 data 存储消息的二进制数据,其数据格式由开发者定义,desc 存储描述文本。一条消息内可以有多个自定义 Elem,并且可以跟其他 Elem 混合排列,离线 Push 时叠加每个 Elem 的 desc 描述信息进行下发。
  464 + *
314 */ 465 */
315 -@property(nonatomic,assign) uint32_t taskId; 466 +@interface TIMCustomElem : TIMElem
316 467
317 /** 468 /**
318 - * 视频文件路径,发送消息时设置 469 + * 自定义消息二进制数据
319 */ 470 */
320 -@property(nonatomic,strong) NSString * videoPath;  
321 - 471 +@property(nonatomic,strong) NSData * data;
322 /** 472 /**
323 - * 视频信息,发送消息时设置 473 + * 自定义消息描述信息,做离线Push时文本展示(已废弃,请使用 TIMMessage 中 offlinePushInfo 进行配置)
324 */ 474 */
325 -@property(nonatomic,strong) TIMVideo * video;  
326 - 475 +@property(nonatomic,strong) NSString * desc DEPRECATED_ATTRIBUTE;
327 /** 476 /**
328 - * 截图文件路径,发送消息时设置 477 + * 离线Push时扩展字段信息(已废弃,请使用 TIMMessage 中 offlinePushInfo 进行配置)
329 */ 478 */
330 -@property(nonatomic,strong) NSString * snapshotPath;  
331 - 479 +@property(nonatomic,strong) NSString * ext DEPRECATED_ATTRIBUTE;
332 /** 480 /**
333 - * 视频截图,发送消息时设置 481 + * 离线Push时声音字段信息(已废弃,请使用 TIMMessage 中 offlinePushInfo 进行配置)
334 */ 482 */
335 -@property(nonatomic,strong) TIMSnapshot * snapshot;  
336 - 483 +@property(nonatomic,strong) NSString * sound DEPRECATED_ATTRIBUTE;
337 @end 484 @end
338 485
339 -#pragma mark - 群系统消息和tip消息 486 +/////////////////////////////////////////////////////////////////////////////////
  487 +//
  488 +// (十一)群 Tips 消息
  489 +//
  490 +/////////////////////////////////////////////////////////////////////////////////
340 491
341 /** 492 /**
342 * 群tips,成员变更信息 493 * 群tips,成员变更信息
@@ -355,7 +506,7 @@ @@ -355,7 +506,7 @@
355 @end 506 @end
356 507
357 /** 508 /**
358 - * 群tips,群变更信息 509 + * 群 tips,群变更信息
359 */ 510 */
360 @interface TIMGroupTipsElemGroupInfo : NSObject 511 @interface TIMGroupTipsElemGroupInfo : NSObject
361 512
@@ -371,12 +522,12 @@ @@ -371,12 +522,12 @@
371 @end 522 @end
372 523
373 /** 524 /**
374 - * 群Tips 525 + * 群 Tips
375 */ 526 */
376 @interface TIMGroupTipsElem : TIMElem 527 @interface TIMGroupTipsElem : TIMElem
377 528
378 /** 529 /**
379 - * 群组Id 530 + * 群组 ID
380 */ 531 */
381 @property(nonatomic,strong) NSString * group; 532 @property(nonatomic,strong) NSString * group;
382 533
@@ -442,7 +593,11 @@ @@ -442,7 +593,11 @@
442 593
443 @end 594 @end
444 595
445 - 596 +/////////////////////////////////////////////////////////////////////////////////
  597 +//
  598 +// (十二)群系统消息
  599 +//
  600 +/////////////////////////////////////////////////////////////////////////////////
446 /** 601 /**
447 * 群系统消息 602 * 群系统消息
448 */ 603 */
@@ -454,7 +609,7 @@ @@ -454,7 +609,7 @@
454 @property(nonatomic,assign) TIM_GROUP_SYSTEM_TYPE type; 609 @property(nonatomic,assign) TIM_GROUP_SYSTEM_TYPE type;
455 610
456 /** 611 /**
457 - * 群组Id 612 + * 群组 ID
458 */ 613 */
459 @property(nonatomic,strong) NSString * group; 614 @property(nonatomic,strong) NSString * group;
460 615
@@ -468,7 +623,6 @@ @@ -468,7 +623,6 @@
468 */ 623 */
469 @property(nonatomic,strong) NSString * msg; 624 @property(nonatomic,strong) NSString * msg;
470 625
471 -  
472 /** 626 /**
473 * 消息标识,客户端无需关心 627 * 消息标识,客户端无需关心
474 */ 628 */
@@ -480,7 +634,7 @@ @@ -480,7 +634,7 @@
480 @property(nonatomic,strong) NSData * authKey; 634 @property(nonatomic,strong) NSData * authKey;
481 635
482 /** 636 /**
483 - * 用户自定义透传消息体(type=TIM_GROUP_SYSTEM_CUSTOM_INFO时有效) 637 + * 用户自定义透传消息体(type = TIM_GROUP_SYSTEM_CUSTOM_INFO 时有效)
484 */ 638 */
485 @property(nonatomic,strong) NSData * userData; 639 @property(nonatomic,strong) NSData * userData;
486 640
@@ -496,16 +650,20 @@ @@ -496,16 +650,20 @@
496 650
497 /** 651 /**
498 * 操作方平台信息 652 * 操作方平台信息
499 - * 取值: iOS Android Windows Mac Web RESTAPI Unknown 653 + * 取值: iOS、Android、Windows、Mac、Web、RESTAPI、Unknown
500 */ 654 */
501 @property(nonatomic,strong) NSString * platform; 655 @property(nonatomic,strong) NSString * platform;
502 656
503 @end 657 @end
504 658
505 -#pragma mark - 消息体TIMMessage  
506 659
  660 +/////////////////////////////////////////////////////////////////////////////////
  661 +//
  662 +// (十三)设置消息推送
  663 +//
  664 +/////////////////////////////////////////////////////////////////////////////////
507 /** 665 /**
508 - 填入sound字段表示接收时不会播放声音 666 + 填入 sound 字段表示接收时不会播放声音
509 */ 667 */
510 extern NSString * const kIOSOfflinePushNoSound; 668 extern NSString * const kIOSOfflinePushNoSound;
511 669
@@ -515,7 +673,7 @@ extern NSString * const kIOSOfflinePushNoSound; @@ -515,7 +673,7 @@ extern NSString * const kIOSOfflinePushNoSound;
515 */ 673 */
516 @property(nonatomic,strong) NSString * desc; 674 @property(nonatomic,strong) NSString * desc;
517 /** 675 /**
518 - * 离线Push时扩展字段信息 676 + * 离线 Push 时扩展字段信息
519 */ 677 */
520 @property(nonatomic,strong) NSString * ext; 678 @property(nonatomic,strong) NSString * ext;
521 /** 679 /**
@@ -533,33 +691,36 @@ extern NSString * const kIOSOfflinePushNoSound; @@ -533,33 +691,36 @@ extern NSString * const kIOSOfflinePushNoSound;
533 @end 691 @end
534 692
535 693
  694 +/////////////////////////////////////////////////////////////////////////////////
  695 +//
  696 +// (十四)消息封装
  697 +//
  698 +/////////////////////////////////////////////////////////////////////////////////
536 /** 699 /**
537 * 消息 700 * 消息
538 */ 701 */
539 @interface TIMMessage : NSObject 702 @interface TIMMessage : NSObject
540 703
541 /** 704 /**
542 - * 增加Elem 705 + * 增加 Elem
543 * 706 *
544 - * @param elem elem结构 707 + * @param elem elem 结构
545 * 708 *
546 - * @return 0 表示成功  
547 - * 1 禁止添加Elem(文件或语音多于两个Elem)  
548 - * 2 未知Elem 709 + * @return 0:表示成功;1:禁止添加 Elem(文件或语音多于两个 Elem);2:未知 Elem
549 */ 710 */
550 - (int)addElem:(TIMElem*)elem; 711 - (int)addElem:(TIMElem*)elem;
551 712
552 /** 713 /**
553 - * 获取对应索引的Elem 714 + * 获取对应索引的 Elem
554 * 715 *
555 * @param index 对应索引 716 * @param index 对应索引
556 * 717 *
557 - * @return 返回对应Elem 718 + * @return 返回对应 Elem
558 */ 719 */
559 - (TIMElem*)getElem:(int)index; 720 - (TIMElem*)getElem:(int)index;
560 721
561 /** 722 /**
562 - * 获取Elem数量 723 + * 获取 Elem 数量
563 * 724 *
564 * @return elem数量 725 * @return elem数量
565 */ 726 */
@@ -577,7 +738,7 @@ extern NSString * const kIOSOfflinePushNoSound; @@ -577,7 +738,7 @@ extern NSString * const kIOSOfflinePushNoSound;
577 /** 738 /**
578 * 获得本消息离线推送配置信息 739 * 获得本消息离线推送配置信息
579 * 740 *
580 - * @return 配置信息,没设置返回nil 741 + * @return 配置信息,没设置返回 nil
581 */ 742 */
582 - (TIMOfflinePushInfo*)getOfflinePushInfo; 743 - (TIMOfflinePushInfo*)getOfflinePushInfo;
583 744
@@ -585,14 +746,14 @@ extern NSString * const kIOSOfflinePushNoSound; @@ -585,14 +746,14 @@ extern NSString * const kIOSOfflinePushNoSound;
585 * 设置业务命令字 746 * 设置业务命令字
586 * 747 *
587 * @param buzCmds 业务命令字列表 748 * @param buzCmds 业务命令字列表
588 - * @"im_open_busi_cmd.msg_robot" 表示发送给IM机器人  
589 - * @"im_open_busi_cmd.msg_nodb" 表示不存离线  
590 - * @"im_open_busi_cmd.msg_noramble" 表示不存漫游  
591 - * @"im_open_busi_cmd.msg_nopush" 表示不实时下发给用户 749 + * @"im_open_busi_cmd.msg_robot":表示发送给IM机器人;
  750 + * @"im_open_busi_cmd.msg_nodb":表示不存离线;
  751 + * @"im_open_busi_cmd.msg_noramble":表示不存漫游;
  752 + * @"im_open_busi_cmd.msg_nopush":表示不实时下发给用户
592 * 753 *
593 - * @return 0 成功 754 + * @return 0:成功;1:buzCmds 为 nil
594 */ 755 */
595 --(int) setBusinessCmd:(NSArray*)buzCmds; 756 +-(int)setBusinessCmd:(NSArray*)buzCmds;
596 757
597 /** 758 /**
598 * 获取会话 759 * 获取会话
@@ -611,7 +772,7 @@ extern NSString * const kIOSOfflinePushNoSound; @@ -611,7 +772,7 @@ extern NSString * const kIOSOfflinePushNoSound;
611 /** 772 /**
612 * 是否发送方 773 * 是否发送方
613 * 774 *
614 - * @return TRUE 表示是发送消息 FALSE 表示是接收消息 775 + * @return TRUE:表示是发送消息;FALSE:表示是接收消息
615 */ 776 */
616 - (BOOL)isSelf; 777 - (BOOL)isSelf;
617 778
@@ -623,12 +784,12 @@ extern NSString * const kIOSOfflinePushNoSound; @@ -623,12 +784,12 @@ extern NSString * const kIOSOfflinePushNoSound;
623 - (NSString*)sender; 784 - (NSString*)sender;
624 785
625 /** 786 /**
626 - * 消息Id 787 + * 消息 ID,当消息生成时,就已经固定,这种方式可能跟其他用户产生的消息冲突,需要再加一个时间约束,可以认为 10 分钟以内的消息可以使用 msgId 区分,需要在同一个会话内判断。
627 */ 788 */
628 - (NSString*)msgId; 789 - (NSString*)msgId;
629 790
630 /** 791 /**
631 - * 获取消息uniqueId 792 + * 消息 uniqueId,当消息发送成功以后才能固定下来(uniqueId),这种方式能保证全局唯一,需要在同一个会话内判断。
632 * 793 *
633 * @return uniqueId 794 * @return uniqueId
634 */ 795 */
@@ -637,22 +798,25 @@ extern NSString * const kIOSOfflinePushNoSound; @@ -637,22 +798,25 @@ extern NSString * const kIOSOfflinePushNoSound;
637 /** 798 /**
638 * 当前消息的时间戳 799 * 当前消息的时间戳
639 * 800 *
640 - * @return 时间戳 801 + * @return 时间戳,该时间是 Server 时间,而非本地时间。在创建消息时,此时间为根据 Server 时间校准过的时间,发送成功后会改为准确的 Server 时间。
641 */ 802 */
642 - (NSDate*)timestamp; 803 - (NSDate*)timestamp;
643 804
644 -  
645 /** 805 /**
646 - * 获取发送者资料(发送者为自己时可能为空) 806 + * 获取发送者资料
647 * 807 *
648 - * @return 发送者资料,nil 表示没有获取资料,目前只有字段:identifier、nickname、faceURL、customInfo 808 + * 如果本地有发送者资料,这里会直接通过 return 值 TIMUserProfile 返回发送者资料,如果本地没有发送者资料,这里会直接 return nil,SDK 内部会向服务器拉取发送者资料,并在 profileCallBack 回调里面返回发送者资料。
  809 + *
  810 + * @param profileCallBack 发送者资料回调
  811 + *
  812 + * @return 发送者资料,nil 表示本地没有获取到资料
649 */ 813 */
650 -- (TIMUserProfile*)getSenderProfile; 814 +- (TIMUserProfile*)getSenderProfile:(ProfileCallBack)profileCallBack;
651 815
652 /** 816 /**
653 * 获取发送者群内资料(发送者为自己时可能为空) 817 * 获取发送者群内资料(发送者为自己时可能为空)
654 * 818 *
655 - * @return 发送者群内资料,nil 表示没有获取资料或者不是群消息,目前只有字段:member、nameCard、role、customInfo 819 + * @return 发送者群内资料,nil 表示没有获取资料或者不是群消息,目前仅能获取字段:member,nameCard,其他的字段获取建议通过 TIMGroupManager+Ext.h -> getGroupMembers 获取
656 */ 820 */
657 - (TIMGroupMemberInfo*)getSenderGroupMemberProfile; 821 - (TIMGroupMemberInfo*)getSenderGroupMemberProfile;
658 822
@@ -666,20 +830,15 @@ extern NSString * const kIOSOfflinePushNoSound; @@ -666,20 +830,15 @@ extern NSString * const kIOSOfflinePushNoSound;
666 - (BOOL)setPriority:(TIMMessagePriority)priority; 830 - (BOOL)setPriority:(TIMMessagePriority)priority;
667 831
668 /** 832 /**
669 - * 获取消息的优先级 833 + * 获取消息的优先级(仅对群组消息有效)
  834 + *
  835 + * 对于直播场景,会有点赞和发红包功能,点赞相对优先级较低,红包消息优先级较高,具体消息内容可以使用 TIMCustomElem 进行定义,发送消息时,可设置消息优先级。
670 * 836 *
671 * @return 优先级 837 * @return 优先级
672 */ 838 */
673 - (TIMMessagePriority)getPriority; 839 - (TIMMessagePriority)getPriority;
674 840
675 /** 841 /**
676 - * 获取消息所属会话的接收消息选项(仅对群组消息有效)  
677 - *  
678 - * @return 接收消息选项  
679 - */  
680 -- (TIMGroupReceiveMessageOpt)getRecvOpt;  
681 -  
682 -/**  
683 * 拷贝消息中的属性(ELem、priority、online、offlinePushInfo) 842 * 拷贝消息中的属性(ELem、priority、online、offlinePushInfo)
684 * 843 *
685 * @param srcMsg 源消息 844 * @param srcMsg 源消息
This file is too large to display.
@@ -14,21 +14,21 @@ @@ -14,21 +14,21 @@
14 14
15 /** 15 /**
16 * 原始声音的回调 16 * 原始声音的回调
17 - * @prarm data pcm数据  
18 - * @prarm timeStamp 时间戳  
19 - * @prarm sampleRate 采样率  
20 - * @prarm channels 声道数  
21 - * @prarm withBgm 回调的数据是否包含bgm,当不开启回声消除时,回调的raw pcm会包含bgm 17 + * @param data pcm数据
  18 + * @param timeStamp 时间戳
  19 + * @param sampleRate 采样率
  20 + * @param channels 声道数
  21 + * @param withBgm 回调的数据是否包含bgm,当不开启回声消除时,回调的raw pcm会包含bgm
22 */ 22 */
23 @optional 23 @optional
24 - (void)onRecordRawPcmData:(NSData *)data timeStamp:(unsigned long long)timeStamp sampleRate:(int)sampleRate channels:(int)channels withBgm:(BOOL)withBgm; 24 - (void)onRecordRawPcmData:(NSData *)data timeStamp:(unsigned long long)timeStamp sampleRate:(int)sampleRate channels:(int)channels withBgm:(BOOL)withBgm;
25 25
26 /** 26 /**
27 * 经过特效处理的声音回调 27 * 经过特效处理的声音回调
28 - * @prarm data pcm数据  
29 - * @prarm timeStamp 时间戳  
30 - * @prarm sampleRate 采样率  
31 - * @prarm channels 声道数 28 + * @param data pcm数据
  29 + * @param timeStamp 时间戳
  30 + * @param sampleRate 采样率
  31 + * @param channels 声道数
32 */ 32 */
33 @optional 33 @optional
34 - (void)onRecordPcmData:(NSData *)data timeStamp:(unsigned long long)timeStamp sampleRate:(int)sampleRate channels:(int)channels; 34 - (void)onRecordPcmData:(NSData *)data timeStamp:(unsigned long long)timeStamp sampleRate:(int)sampleRate channels:(int)channels;
@@ -11,9 +11,9 @@ @@ -11,9 +11,9 @@
11 11
12 /// HLS多码率信息 12 /// HLS多码率信息
13 @interface TXBitrateItem : NSObject 13 @interface TXBitrateItem : NSObject
14 -@property (nonatomic, assign) NSInteger index; /// m3u8文件中的序号  
15 -@property (nonatomic, assign) NSInteger width; /// 此流的视频宽度  
16 -@property (nonatomic, assign) NSInteger height; /// 此流的视频高度  
17 -@property (nonatomic, assign) NSInteger bitrate; /// 此流的视频码率 14 +@property (nonatomic, assign) NSInteger index; ///< m3u8 文件中的序号
  15 +@property (nonatomic, assign) NSInteger width; ///< 此流的视频宽度
  16 +@property (nonatomic, assign) NSInteger height; ///< 此流的视频高度
  17 +@property (nonatomic, assign) NSInteger bitrate; ///< 此流的视频码率
18 @end 18 @end
19 #endif /* TXBitrateItem_h */ 19 #endif /* TXBitrateItem_h */