Commit d34e0e52 by pierce

解决启动卡顿主线程的问题

parent ce163296
...@@ -145,16 +145,17 @@ ...@@ -145,16 +145,17 @@
- (void)loginWithAccount:(NSString *)account passWord:(NSString *)passWord success:(void(^)(void))success failure:(void(^)(NSString *errorMsg))failure - (void)loginWithAccount:(NSString *)account passWord:(NSString *)passWord success:(void(^)(void))success failure:(void(^)(NSString *errorMsg))failure
{ {
[[EMClient sharedClient] loginWithUsername:account password:passWord completion:^(NSString *aUsername, EMError *aError) { dispatch_async(dispatch_get_global_queue(0, 0), ^{
if (!aError || aError.code == 200) { [[EMClient sharedClient] loginWithUsername:account password:passWord completion:^(NSString *aUsername, EMError *aError) {
if (!aError || aError.code == 200) {
[[NSNotificationCenter defaultCenter] postNotificationName:@"refresh_hyLogin_state" object:nil];
if (success) success(); if (success) success();
}else{ }else{
if (failure) failure(aError.errorDescription); if (failure) failure(aError.errorDescription);
[self uploadEaseMobLoginFailLogWithAccount:account passWord:passWord errorObj:aError]; [self uploadEaseMobLoginFailLogWithAccount:account passWord:passWord errorObj:aError];
} }
}]; }];
});
} }
- (void)fus_autoLoginWithAccount:(NSString *)account - (void)fus_autoLoginWithAccount:(NSString *)account
...@@ -166,6 +167,7 @@ ...@@ -166,6 +167,7 @@
[self loginWithAccount:account passWord:_myUserPwd success:^{ [self loginWithAccount:account passWord:_myUserPwd success:^{
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
[[NSNotificationCenter defaultCenter] postNotificationName:@"refresh_hyLogin_state" object:nil];
if (self.imLoginSucceedHandler) { if (self.imLoginSucceedHandler) {
self.imLoginSucceedHandler(); self.imLoginSucceedHandler();
self.imLoginSucceedHandler = nil; self.imLoginSucceedHandler = nil;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment