zoukankan      html  css  js  c++  java
  • 注册

            __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];

  • 相关阅读:
    Mysql关键字冲突的解决方案
    js日期时间函数
    Mysql字符串字段中是否包含某个字符串,用 find_in_set
    mysql中 where in 用法
    Best of Best系列(4)——AAAI
    Best of Best系列(5)——IJCAI
    Best of Best系列(3)——ICML
    Best of Best系列(6)——SIGIR
    Best of Best系列(2)——ICCV
    Best of Best系列(1)——CVPR
  • 原文地址:https://www.cnblogs.com/-ios/p/4669656.html
Copyright © 2011-2022 走看看