0
私はこのエラーを得続ける "結果==失敗-------------"AFHTTPSessionManager HTTP登録、Objective-CのIOS
のNSLogは、私が「
email = test;
firstname = "<UITextField: 0x7ffe7be159b0; frame = (184 71; 132 30); text = 'test'; clipsToBounds = YES; opaque = NO; autoresize = RM+BM; gestureRecognizers = <NSArray: 0x600000248340>; layer = <CALayer: 0x60800003c1e0>>";
lastname = "<UITextField: 0x7ffe7bc0d440; frame = (184 144; 132 30); text = 'test'; clipsToBounds = YES; opaque = NO; autoresize = RM+BM; gestureRecognizers = <NSArray: 0x600000248b50>; layer = <CALayer: 0x6000000384c0>>";
password = test;
語りますユーザー名、姓、電子メールアドレス、およびパスワードをクラスのWebサイトに登録しようとしています。ここで
は、登録するための私のコードです:
(IBAction)createAcct:(id)sender {
if ([self.firstName.text isEqualToString:@""] || [self.lastName.text isEqualToString:@""] || [self.emailtxt.text isEqualToString:@""] || [self.passwordTxt.text isEqualToString:@""]){
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Dont leave text feild blank!" delegate:self cancelButtonTitle:@"done" otherButtonTitles:nil];
[alert show];
}
NSDictionary *parameters = @{@"email": [NSString stringWithFormat:@"%@", _emailtxt.text], @"password": [NSString stringWithFormat:@"%@", _passwordTxt.text], @"firstname" : [NSString stringWithFormat:@"%@", _firstName], @"lastname" : [NSString stringWithFormat: @"%@", _lastName]};
NSLog(@"%@", parameters);
AFHTTPSessionManager *manager = [[AFHTTPSessionManager alloc]initWithSessionConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]];
[manager setRequestSerializer:[AFHTTPRequestSerializer serializer]];
[manager setResponseSerializer:[AFJSONResponseSerializer serializer]];
[manager POST:@"http://www.tageninformatics.com/client/jwu/csis3070_assignment3/user/register/" parameters:parameters progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject){
NSLog(@"success");
NSDictionary *data = responseObject;
NSString *dataString = [NSString stringWithFormat:@"%@", [data objectForKey:@"result"]];
NSLog(@"result == %@ -------------", dataString);
if ([dataString isEqualToString:@"success"]){
[[NSUserDefaults standardUserDefaults] setObject:dataString forKey:@"success"];
[[NSUserDefaults standardUserDefaults] synchronize];
NSLog(@"%@", dataString);
//store the token
} else {
//error for storing the token
}
}
failure:^(NSURLSessionDataTask * task, NSError * error) {
NSLog(@"error: %@", error);
}];
}