• 注册


            __weak typeof(self) weakSelf=self;

            

            NSUserDefaults *use = [NSUserDefaults standardUserDefaults];

            NSLog(@"%@",[use valueForKey:@"clientId"]);

            

            AFHTTPRequestOperationManager *manager=[AFHTTPRequestOperationManager manager];

            

            NSURL *url = [NSURL URLWithString:@"服务器"];

            NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];

            [request setHTTPMethod:@"POST"];

             NSString *bodyStr = [NSString stringWithFormat:@"verify=%@&phone=%@&password=%@&password2=%@&recommend=@""",_TextCode.text,_phoneNumbertextfield.text,_passwordTextField.text,_againTextField.text];

            //clientid=%@

            bodyStr=[bodyStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

            NSLog(@"%@",kSid);

            [request setHTTPBody:[bodyStr dataUsingEncoding:NSUTF8StringEncoding]];

            manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];

            

            NSOperation *operation = [manager HTTPRequestOperationWithRequest:request success:^(AFHTTPRequestOperation *operation, id responseObject) {

                NSLog(@"开始打印%@",responseObject);

                if ([responseObject[@"code"]isEqualToString:@"100"]) {

                    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"注册成功,请登录!" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];

                    [alert show];

                    [self.navigationController popViewControllerAnimated:YES];

                    

                }else if([responseObject[@"code"]isEqualToString:@"101"]){

                    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"该手机号已注册" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];

                    [alert show];

                }

                //[responseObject[@"code"]isEqualToString:@"100"]

                

            } failure:^(AFHTTPRequestOperation *operation, NSError *error) {

                

                NSLog(@"Error: %@", error);

            }];

            [manager.operationQueue addOperation:operation];

  • 相关阅读:
    Redis入门
    k8s dubbo微服务之maven配置
    NoSQL发展历史与阿里巴巴架构演进分析
    k8s交付dubbo微服务之部署Jenkins
    k8s版本平滑升级
    读 <The Lost Horizon> 感
    luogu P1026 统计单词个数
    acm一些小细节/技巧
    数据结构与算法——常用高级数据结构及其Java实现
    数据结构与算法——常用排序算法及其Java实现
  • 原文地址:https://www.cnblogs.com/-ios/p/4669656.html
Copyright © 2020-2023  润新知