登錄
- (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 ]; 應(yīng)該是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);
}
}