我在 JSON 解析中遇到了麻烦。当我完成代码并运行它时,就会出现问题:
选择器“显示警报:带有消息”没有已知的类方法。
以下是我的代码:
if (!isValid) {
[AppDelegate showAlert:@"Alert!" withMessage:strMessage];
}
return isValid;
}
-(void)registerUser{
[Loading startLoading:YES];
NSString *urlString = [NSString stringWithFormat:@"URL=//%@",Access_Token];
//username, password, name, email, country
NSString *parameter = [NSString stringWithFormat:@"firstname=%@&lastname=%@email=%@&username=%@&password=%@&confirmpassword=@",fnameField.text,lnameField.text,eamilField.text,unameField.text,passField.text,cpassField];
NSConnection *conn = [[NSConnection alloc] initWithDelegate:self];
[conn sendRequest:urlString withParaMeter:parameter withMethod:@"POST" withTag:1];
[conn startAsynchronousRequest];
}
-(void)NSConnection:(NSConnection*)conn didFailWithError:(NSError*)error withTag:(int)tag{
NSLog(@"error is:- %@",[error description]);
}
-(void)NSConnection:(NSConnection*)request didSuccessWithItems:(NSDictionary*)dicData withData:(NSData*)data withTag:(int)tag{
NSLog(@"all data is:- %@",dicData);
int returnCode = [[dicData valueForKeyPath:@"process.returncode"] intValue];
NSString *strMessage = @"";
returnCode = 0;
switch (returnCode) {
case 0:
break;
case 1:
strMessage = @"User not logged in/process Id not available.";
break;
case 2:
strMessage = @"Invalid parameters passed.";
break;
case 3:
strMessage = @"Access token doesn't exist.";
break;
default:
strMessage = @"User name allready exist.";
break;
}
[AppDelegate showAlert:@"Alert!" withMessage:strMessage];
[Loading stopLoading];
[self.navigationController popViewControllerAnimated:YES];
请帮帮我。