- (IBAction)logOut:(id)sender {
UIAlertController* alertcontroller = [UIAlertController alertControllerWithTitle:@"提示!" message:@"是否退出登录" preferredStyle:UIAlertControllerStyleActionSheet];
UIAlertAction* confirmAction = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
[self showLoadingView];
[Okhttp post:cusLogoutUrl params:nil success:^(NSString *response) {
NSData* temp = response;
response = [[NSString alloc] initWithData:temp encoding:NSUTF8StringEncoding];
NSString* s = @"\"success\"";
if([response isEqualToString:s]){
[self customerIsExit];
[self hideLoadingView];
[MBProgressHUD showSuccess:@"已退出登录"];
[self dismissViewControllerAnimated:YES completion:nil];
}
} failure:^(NSError *error) {
[self hideLoadingView];
[MBProgressHUD showError:@"请重试"];
}];
}];
UIAlertAction* cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
// NSLog(@"cancelAction");
}];
[alertcontroller addAction:confirmAction];
[alertcontroller addAction:cancelAction];
[self presentViewController:alertcontroller animated:YES completion:nil];
}
UIAlertController* alertcontroller = [UIAlertController alertControllerWithTitle:@"提示!" message:@"是否退出登录" preferredStyle:UIAlertControllerStyleActionSheet];
UIAlertAction* confirmAction = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
[self showLoadingView];
[Okhttp post:cusLogoutUrl params:nil success:^(NSString *response) {
NSData* temp = response;
response = [[NSString alloc] initWithData:temp encoding:NSUTF8StringEncoding];
NSString* s = @"\"success\"";
if([response isEqualToString:s]){
[self customerIsExit];
[self hideLoadingView];
[MBProgressHUD showSuccess:@"已退出登录"];
[self dismissViewControllerAnimated:YES completion:nil];
}
} failure:^(NSError *error) {
[self hideLoadingView];
[MBProgressHUD showError:@"请重试"];
}];
}];
UIAlertAction* cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
// NSLog(@"cancelAction");
}];
[alertcontroller addAction:confirmAction];
[alertcontroller addAction:cancelAction];
[self presentViewController:alertcontroller animated:YES completion:nil];
}