NSString *urlString = @"http://chkdin.com/dev/api/peoplearoundmexy/?";
NSURL *url = [NSURL URLWithString:urlString];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
NSString *parameterString=[NSString stringWithFormat:@"skey=%@&user_id=%@",@"sa6rw9er7twefc9a7dvcxcheckedin",@"3225"];
NSLog(@"%@",parameterString);
[request setHTTPMethod:@"POST"];
[request setURL:url];
[request setValue:parameterString forHTTPHeaderField:@"Content-Length"];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
NSData *postData = [parameterString dataUsingEncoding:NSUTF8StringEncoding];
[request setHTTPBody:postData];
NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:&error];
NSLog(@"%@",[NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&error]);
NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&error];
NSLog(@"%@",dict);
這是我的JSON解析,我的問題是,當我打這個API,它顯示Json的代碼是不能工作
{
message = "Valid skey required.";
status = 0;
}
但是這個API是工作在safari.i我覺得是問題是爲請求添加到URL錯誤。你能幫助我,請....
你遇到了什麼問題 –
結果顯示是有效的密鑰必需的,但skey在url中工作。 –
http://chkdin.com/dev/api/peoplearoundmexy/?skey=sa6rw9er7twefc9a7dvcxcheckedin&user_id=3225 –