我正在编写如下代码
-(void)changePwd:(NSString*)userId oldPassword:(NSString*)oldPwd newPwd:(NSString*)newPwd delegate:(id)aDelegate
{
self.delegate = aDelegate;
NSString *strURL = [NSString stringWithFormat:@"%@ChangePassword/?uid=%@&OldPwd=%@&NewPwd=%@",kServerURL,userId,oldPwd,newPwd];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL: [NSURL URLWithString: strURL]];
[request setHTTPMethod:@"GET"];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"content-type"];
[request setValue:@"application/json" forHTTPHeaderField:@"Accept"];
[self sendRequest:request];
}
我收到以下错误
(null) ----- error :Error Domain=org.brautaset.JSON.ErrorDomain Code=4 "Valid fragment, but not JSON" UserInfo=0x10d2532a0 {NSLocalizedDescription=Valid fragment, but not JSON}
但是当我在浏览器中使用链接时,我会在成功时获得如下响应
"Success"
当失败时如下
"Failed"