Commit 059adb720564db1a27136184404bbe10eef1fea7

Authored by 王军波
1 parent 94121183

Demo增加获取聊天室人数

CNLiveChatSDKDemo/CNLiveChatManager.framework/CNLiveChatManager
No preview for this file type
CNLiveChatSDKDemo/CNLiveChatSDKDemo.xcodeproj/project.pbxproj
... ... @@ -7,12 +7,14 @@
7 7 objects = {
8 8  
9 9 /* Begin PBXBuildFile section */
  10 + D20C82AB1EEE892400BB609F /* CNLiveChatManager.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D20C82AA1EEE892400BB609F /* CNLiveChatManager.framework */; };
  11 + D20C82AD1EEE892800BB609F /* CNLiveChatManager.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = D20C82AA1EEE892400BB609F /* CNLiveChatManager.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
  12 + D20C82AF1EEE892B00BB609F /* CNLiveMsgTools.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D20C82A81EEE891D00BB609F /* CNLiveMsgTools.framework */; };
  13 + D20C82B01EEE892B00BB609F /* CNLiveMsgTools.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = D20C82A81EEE891D00BB609F /* CNLiveMsgTools.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
10 14 D2239CD41EE94F31005572FB /* praiseModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D2239CD31EE94F31005572FB /* praiseModel.m */; };
11 15 D231941F1E70101500111C3B /* MessageModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D231941E1E70101500111C3B /* MessageModel.m */; };
12 16 D231C8A61E6FFC2700EAC427 /* ChatRoomViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D231C8A51E6FFC2700EAC427 /* ChatRoomViewController.m */; };
13 17 D231C8A91E6FFD3100EAC427 /* PrivateViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D231C8A81E6FFD3100EAC427 /* PrivateViewController.m */; };
14   - D244EFE61EE9176200C1B9DB /* CNLiveChatManager.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D2868FED1EE916780037DECF /* CNLiveChatManager.framework */; };
15   - D244EFE71EE9176200C1B9DB /* CNLiveChatManager.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = D2868FED1EE916780037DECF /* CNLiveChatManager.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
16 18 D244EFEA1EE9246D00C1B9DB /* CNLiveCommentTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D244EFE91EE9246D00C1B9DB /* CNLiveCommentTableViewCell.m */; };
17 19 D264D5A51E6FDE02002CDF41 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = D264D5A41E6FDE02002CDF41 /* main.m */; };
18 20 D264D5A81E6FDE02002CDF41 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = D264D5A71E6FDE02002CDF41 /* AppDelegate.m */; };
... ... @@ -21,19 +23,17 @@
21 23 D264D5B01E6FDE02002CDF41 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D264D5AF1E6FDE02002CDF41 /* Assets.xcassets */; };
22 24 D264D5B31E6FDE02002CDF41 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D264D5B11E6FDE02002CDF41 /* LaunchScreen.storyboard */; };
23 25 D2868FEC1EE914690037DECF /* CommentViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D2868FEB1EE914690037DECF /* CommentViewController.m */; };
24   - D2CE6F001EE80EE7007CEA51 /* CNLiveMsgTools.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D2CE6EFF1EE80EE7007CEA51 /* CNLiveMsgTools.framework */; };
25   - D2CE6F061EE80EF6007CEA51 /* CNLiveMsgTools.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = D2CE6EFF1EE80EE7007CEA51 /* CNLiveMsgTools.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
26 26 /* End PBXBuildFile section */
27 27  
28 28 /* Begin PBXCopyFilesBuildPhase section */
29   - D264D5C11E6FE301002CDF41 /* Embed Frameworks */ = {
  29 + D20C82AE1EEE892900BB609F /* Embed Frameworks */ = {
30 30 isa = PBXCopyFilesBuildPhase;
31 31 buildActionMask = 2147483647;
32 32 dstPath = "";
33 33 dstSubfolderSpec = 10;
34 34 files = (
35   - D2CE6F061EE80EF6007CEA51 /* CNLiveMsgTools.framework in Embed Frameworks */,
36   - D244EFE71EE9176200C1B9DB /* CNLiveChatManager.framework in Embed Frameworks */,
  35 + D20C82AD1EEE892800BB609F /* CNLiveChatManager.framework in Embed Frameworks */,
  36 + D20C82B01EEE892B00BB609F /* CNLiveMsgTools.framework in Embed Frameworks */,
37 37 );
38 38 name = "Embed Frameworks";
39 39 runOnlyForDeploymentPostprocessing = 0;
... ... @@ -41,6 +41,8 @@
41 41 /* End PBXCopyFilesBuildPhase section */
42 42  
43 43 /* Begin PBXFileReference section */
  44 + D20C82A81EEE891D00BB609F /* CNLiveMsgTools.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = CNLiveMsgTools.framework; sourceTree = "<group>"; };
  45 + D20C82AA1EEE892400BB609F /* CNLiveChatManager.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = CNLiveChatManager.framework; sourceTree = "<group>"; };
44 46 D2239CD21EE94F31005572FB /* praiseModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = praiseModel.h; sourceTree = "<group>"; };
45 47 D2239CD31EE94F31005572FB /* praiseModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = praiseModel.m; sourceTree = "<group>"; };
46 48 D231941D1E70101500111C3B /* MessageModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MessageModel.h; sourceTree = "<group>"; };
... ... @@ -64,8 +66,6 @@
64 66 D264D5BE1E6FDEED002CDF41 /* PrefixHeader.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PrefixHeader.pch; sourceTree = "<group>"; };
65 67 D2868FEA1EE914690037DECF /* CommentViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommentViewController.h; sourceTree = "<group>"; };
66 68 D2868FEB1EE914690037DECF /* CommentViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CommentViewController.m; sourceTree = "<group>"; };
67   - D2868FED1EE916780037DECF /* CNLiveChatManager.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = CNLiveChatManager.framework; sourceTree = "<group>"; };
68   - D2CE6EFF1EE80EE7007CEA51 /* CNLiveMsgTools.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = CNLiveMsgTools.framework; sourceTree = "<group>"; };
69 69 /* End PBXFileReference section */
70 70  
71 71 /* Begin PBXFrameworksBuildPhase section */
... ... @@ -73,8 +73,8 @@
73 73 isa = PBXFrameworksBuildPhase;
74 74 buildActionMask = 2147483647;
75 75 files = (
76   - D2CE6F001EE80EE7007CEA51 /* CNLiveMsgTools.framework in Frameworks */,
77   - D244EFE61EE9176200C1B9DB /* CNLiveChatManager.framework in Frameworks */,
  76 + D20C82AF1EEE892B00BB609F /* CNLiveMsgTools.framework in Frameworks */,
  77 + D20C82AB1EEE892400BB609F /* CNLiveChatManager.framework in Frameworks */,
78 78 );
79 79 runOnlyForDeploymentPostprocessing = 0;
80 80 };
... ... @@ -119,8 +119,8 @@
119 119 D264D5971E6FDE02002CDF41 = {
120 120 isa = PBXGroup;
121 121 children = (
122   - D2868FED1EE916780037DECF /* CNLiveChatManager.framework */,
123   - D2CE6EFF1EE80EE7007CEA51 /* CNLiveMsgTools.framework */,
  122 + D20C82AA1EEE892400BB609F /* CNLiveChatManager.framework */,
  123 + D20C82A81EEE891D00BB609F /* CNLiveMsgTools.framework */,
124 124 D264D5A21E6FDE02002CDF41 /* CNLiveChatSDKDemo */,
125 125 D264D5A11E6FDE02002CDF41 /* Products */,
126 126 );
... ... @@ -170,7 +170,7 @@
170 170 D264D59C1E6FDE02002CDF41 /* Sources */,
171 171 D264D59D1E6FDE02002CDF41 /* Frameworks */,
172 172 D264D59E1E6FDE02002CDF41 /* Resources */,
173   - D264D5C11E6FE301002CDF41 /* Embed Frameworks */,
  173 + D20C82AE1EEE892900BB609F /* Embed Frameworks */,
174 174 );
175 175 buildRules = (
176 176 );
... ...
CNLiveChatSDKDemo/CNLiveChatSDKDemo/ChatRoomViewController.m
... ... @@ -18,6 +18,8 @@ static NSString *cellId = @&quot;cellId&quot;;
18 18  
19 19 @property (nonatomic, strong) UITextField *textField;
20 20  
  21 +@property (nonatomic, strong) UILabel *chatRoomPersonCountLabel;
  22 +
21 23 @property (nonatomic, strong) UITableView *tableView;
22 24  
23 25 @end
... ... @@ -38,6 +40,13 @@ static NSString *cellId = @&quot;cellId&quot;;
38 40 [[CNLiveChatManager sharedCNLiveChatManager] joinChatRoom:@"67_7788" messageCount:10 success:^(NSString *targetId) {
39 41  
40 42 NSLog(@"已成功加入聊天室:%@",targetId);
  43 + [self getChatRoomPersonCount];
  44 +
  45 + dispatch_async(dispatch_get_global_queue(0, 0), ^{
  46 + [NSTimer scheduledTimerWithTimeInterval:5 target:self selector:@selector(getChatRoomPersonCount) userInfo:nil repeats:YES];
  47 + [[NSRunLoop currentRunLoop] run];
  48 + });
  49 +
41 50  
42 51 } error:^(CNLiveChatErrorCode errors, NSString *targetId) {
43 52  
... ... @@ -49,6 +58,7 @@ static NSString *cellId = @&quot;cellId&quot;;
49 58 gestureRecognizer.cancelsTouchesInView = YES;
50 59 [self.tableView addGestureRecognizer:gestureRecognizer];
51 60 [self.view addSubview:self.textField];
  61 + [self.view addSubview:self.chatRoomPersonCountLabel];
52 62  
53 63 _messageArrayM = [[NSMutableArray alloc] init];
54 64 }
... ... @@ -65,26 +75,22 @@ static NSString *cellId = @&quot;cellId&quot;;
65 75 }
66 76  
67 77  
68   -#pragma mark - 懒加载 !!!!!!!!!!!!!!!!!!!!!!!!!!
69   -- (UITextField *)textField {
  78 +#pragma mark - 获取聊天室人数
  79 +- (void)getChatRoomPersonCount {
70 80  
71   - if (!_textField) {
72   - _textField = [self createTextFieldWithFrame:CGRectMake(10, 74, KScreenWidth - 20, 40) font:20];
73   - _textField.delegate = self;
74   - }
75   - return _textField;
  81 + [[CNLiveChatManager sharedCNLiveChatManager] getChatRoomInfo:@"67_7788" success:^(int totalMemberCount) {
  82 +
  83 + NSLog(@"success: %d",totalMemberCount);
  84 + dispatch_async(dispatch_get_main_queue(), ^{
  85 + self.chatRoomPersonCountLabel.text = [NSString stringWithFormat:@"聊天室人数为:%d",totalMemberCount];
  86 + });
  87 +
  88 + } error:^(CNLiveChatErrorCode status) {
  89 +
  90 + NSLog(@"failed");
  91 + }];
76 92 }
77 93  
78   --(UITableView *)tableView {
79   - if (!_tableView) {
80   - _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 124, KScreenWidth, KScreenHeight - 425) style:UITableViewStylePlain];
81   - _tableView.rowHeight = 30;
82   - _tableView.delegate = self;
83   - _tableView.dataSource = self;
84   - [_tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:cellId];
85   - }
86   - return _tableView;
87   -}
88 94  
89 95 #pragma mark - UITableViewDelegate,UITableViewDataSource !!!!!!!!!!!!!!!!!!!!!!!!!!
90 96  
... ... @@ -216,6 +222,36 @@ static NSString *cellId = @&quot;cellId&quot;;
216 222 }
217 223  
218 224  
  225 +#pragma mark - Get Method !!!!!!!!!!!!!!!!!!!!!!!!!!
  226 +- (UITextField *)textField {
  227 +
  228 + if (!_textField) {
  229 + _textField = [self createTextFieldWithFrame:CGRectMake(10, 74, KScreenWidth - 20, 40) font:20];
  230 + _textField.delegate = self;
  231 + }
  232 + return _textField;
  233 +}
  234 +
  235 +- (UILabel *)chatRoomPersonCountLabel {
  236 +
  237 + if (!_chatRoomPersonCountLabel) {
  238 + _chatRoomPersonCountLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 124, KScreenWidth - 20, 35)];
  239 + }
  240 + return _chatRoomPersonCountLabel;
  241 +}
  242 +
  243 +-(UITableView *)tableView {
  244 + if (!_tableView) {
  245 + _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 159, KScreenWidth, KScreenHeight - 425) style:UITableViewStylePlain];
  246 + _tableView.rowHeight = 30;
  247 + _tableView.delegate = self;
  248 + _tableView.dataSource = self;
  249 + [_tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:cellId];
  250 + }
  251 + return _tableView;
  252 +}
  253 +
  254 +
219 255 #pragma mark - 创建文本框 !!!!!!!!!!!!!!!!!!!!!!!!!!
220 256 - (UITextField *)createTextFieldWithFrame:(CGRect)frame font:(float)font {
221 257  
... ...
CNLiveChatSDKDemo/CNLiveMsgTools.framework/CNLiveMsgTools
No preview for this file type