环信 : 即时通信 Debug

登录


- (IBAction)loginBtn:(id)sender {
    
    EMError * error = [[EMClient sharedClient ] loginWithUsername:self.usernameTF.text password:self.passwordTF.text ];
//    EMError * error = [[EMClient sharedClient ] registerWithUsername:self.usernameTF.text password:self.passwordTF.text ];       应该是loginWithUsername
    if (!error){
        
        NSLog(@"登录成功");
        
        
       [[EMClient sharedClient].options setIsAutoLogin:YES];
        
        
        
        UIStoryboard * storyboard = [UIStoryboard storyboardWithName: @"Main" bundle:[NSBundle mainBundle ] ];
//         UIStoryboard * storyboard = [UIStoryboard storyboardWithName: @"main" bundle:[NSBundle mainBundle ] ];               main小写
        
        
        UITabBarController * tbc = [storyboard instantiateViewControllerWithIdentifier: @"tabbar" ];
        
        [self presentViewController: tbc animated: YES completion:^{  }];
        
        
    }else{
    
    
        NSLog(error);
    
    }
    
    



}

注册

- (IBAction)registerBtn:(id)sender {
    

    EMError * error = [[EMClient sharedClient ] registerWithUsername:self.usernameTF.text password:self.passwordTF.text ];
    
    
    if (error == nil){
    
        NSLog(@"注册成功");
    
    
    }else{
        
        
        NSLog(error);
        
    }
    
    
    
}



你可能感兴趣的:(环信 : 即时通信 Debug)