Skip to content

Commit 159231b

Browse files
guangyaoguangyao
authored andcommitted
fix 监听踢下线的问题
1 parent 079b803 commit 159231b

File tree

3 files changed

+23
-20
lines changed

3 files changed

+23
-20
lines changed

ios/RNNeteaseIm/RNNeteaseIm/NIMModel.m

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,10 @@ -(void)setNetStatus:(NSString *)NetStatus{
4343
}
4444
}
4545
-(void)setNIMKick:(NSString *)NIMKick{
46-
if ((_NIMKick != NIMKick)&&(NIMKick.length)) {
4746
_NIMKick = NIMKick;
4847
if (self.myBlock) {
4948
self.myBlock(2, NIMKick);
5049
}
51-
}
5250
}
5351
//通信录列表
5452
-(void)setContactList:(NSMutableDictionary *)contactList{

ios/RNNeteaseIm/RNNeteaseIm/NIMViewController.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
typedef void(^SUCCESS) (id param);
1313
typedef void(^ERROR)(NSString *error);
1414
@interface NIMViewController : UIViewController
15+
1516
+(instancetype)initWithController;
1617
-(instancetype)initWithNIMController;
1718
-(void)deleteCurrentSession:(NSString *)recentContactId andback:(ERROR)error;

ios/RNNeteaseIm/RNNeteaseIm/NIMViewController.m

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
#import "NIMViewController.h"
1010
#import "ContactViewController.h"
1111

12-
@interface NIMViewController ()<NIMLoginManagerDelegate,NIMConversationManagerDelegate>
12+
@interface NIMViewController ()<NIMLoginManagerDelegate,NIMConversationManagerDelegate>{
13+
14+
}
1315

1416
@end
1517

@@ -102,25 +104,27 @@ -(void)deleteCurrentSession:(NSString *)recentContactId andback:(ERROR)error{
102104
#pragma NIMLoginManagerDelegate
103105
-(void)onKick:(NIMKickReason)code clientType:(NIMLoginClientType)clientType
104106
{
105-
switch (code) {
106-
case NIMKickReasonByClient:{//被另外一个客户端踢下线 (互斥客户端一端登录挤掉上一个登录中的客户端)
107-
[NIMModel initShareMD].NIMKick = @"1";
108-
}
109-
break;
110-
case NIMKickReasonByClientManually:{//被另外一个客户端手动选择踢下线
111-
[NIMModel initShareMD].NIMKick = @"3";
112-
}
113-
break;
114-
case NIMKickReasonByServer:{//你被服务器踢下线
115-
[NIMModel initShareMD].NIMKick = @"2";
107+
108+
switch (code) {
109+
case NIMKickReasonByClient:{//被另外一个客户端踢下线 (互斥客户端一端登录挤掉上一个登录中的客户端)
110+
[NIMModel initShareMD].NIMKick = @"1";
111+
}
112+
break;
113+
case NIMKickReasonByClientManually:{//被另外一个客户端手动选择踢下线
114+
[NIMModel initShareMD].NIMKick = @"3";
115+
}
116+
break;
117+
case NIMKickReasonByServer:{//你被服务器踢下线
118+
[NIMModel initShareMD].NIMKick = @"2";
119+
}
120+
break;
121+
default:
122+
break;
116123
}
117-
break;
118-
default:
119-
break;
120-
}
121-
[[[NIMSDK sharedSDK] loginManager] logout:^(NSError *error) {
122-
}];
124+
[[[NIMSDK sharedSDK] loginManager] logout:^(NSError *error) {
125+
}];
123126
}
127+
124128
- (void)onAutoLoginFailed:(NSError *)error{
125129

126130
NSLog(@"自动登录失败");

0 commit comments

Comments
 (0)