使用json时出错错误Domain = org.brautaset.JSON.ErrorDomain Code = 4“有效片段

时间:2014-03-05 10:02:28

标签: ios objective-c json xcode web-services

我正在编写如下代码

-(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"

0 个答案:

没有答案