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

  • 相关阅读:
    [模板] 主席树
    [模板] 替罪羊树
    [模板] Treap
    [LUOGU] P4342 [IOI1998]Polygon
    [JOYOI] 1051 选课
    poj 1845 数论(唯一分解定理+分治法求等比数列前n项的和mod m的值)
    poj 2418 bst统计字符串
    hdu 3791 二叉排序树
    hdu 3999 二叉排序树
    toj 3711 水题
  • 原文地址:https://www.cnblogs.com/-ios/p/4669656.html
Copyright © 2011-2022 走看看