データをAFNetworking
POST
メソッドで送信し、サーバーから結果を取得します。 この私のNSDictionary
:このNSDictionaryの私のサーバーを送信POSTメソッドAFネットワーク応答が完了していない
{
"category_id" = "-1";
"city_id" = "-1";
"degree_id" = "-1";
"experience_id" = "-1";
industries = (
{
id = 2;
},
{
id = 4;
},
{
id = 3;
}
);
"position_id" = "-1";
"salary_id" = "-1";
skills = (
{
aa = id;
},
{
aa = asdasda;
}
);
"type_id" = "-1";
}
はこのように私のデータを受け取る:
{
"category_id" = "-1";
"city_id" = "-1";
"degree_id" = "-1";
"experience_id" = "-1";
industries = (
2,
4,
3
);
"position_id" = "-1";
"salary_id" = "-1";
skills = (
id,
asdasda
);
"type_id" = "-1";
}
私はこれからとても困惑しています!
業種&スキルがNSDictionaryの辞書の配列ですが、サーバーがキーを表示せず、配列の値のみを表示する場合
私はそれについてご案内してください。
これは私のPOST
方法です:
self.params = [[NSMutableDictionary alloc]init];
[self.params setObject:[NSNumber numberWithInteger:[self.object.jobCategory integerValue]] forKey:@"category_id"];
[self.params setObject:[NSNumber numberWithInteger:[self.object.jobCity integerValue]] forKey:@"city_id"];
[self.params setObject:self.object.industry forKey:@"industries"];
[self.params setObject:[NSNumber numberWithInteger:[self.object.educationDegree integerValue]] forKey:@"degree_id"];
[self.params setObject:[NSNumber numberWithInteger:[self.object.experience integerValue]] forKey:@"experience_id"];
[self.params setObject:[NSNumber numberWithInteger:[self.object.jobType integerValue]] forKey:@"type_id"];
[self.params setObject:[NSNumber numberWithInteger:[self.object.jobSalary integerValue]] forKey:@"salary_id"];
[self.params setObject:[NSNumber numberWithInteger:[self.object.jobPosition integerValue]] forKey:@"position_id"];
[self.params setObject:[NSMutableArray array] forKey:@"skills"];
[[self.params objectForKey:@"skills"] addObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:@"id",@"aa", nil]];
[[self.params objectForKey:@"skills"] addObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:@"asdasda",@"aa", nil]];
//NSData *jsonData = [NSJSONSerialization dataWithJSONObject:self.params options:NSJSONWritingPrettyPrinted error:nil];
//NSString *str = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
NSLog(@"%@",self.params);
NSString* path = [NSString stringWithFormat:@"%@%@" , [PublicMethods getStrings:@"url"],[PublicMethods getStrings:@"searchJob"]];
[self.network callPOSTWebServiceWithPath:path AndWithParameters:self.params withCallback:^(NSDictionary *result)
{
NSLog(@"%@",result);
if ([[result objectForKey:@"result"]boolValue])
{
NSLog(@"%@",[result objectForKey:@"data"]);
}
else
{
//error accured
}
}];
あなたが表示する2番目のログは 'self.params'ですか?それが正しいかどうかを確認するために 'self.object.industry'をログに記録しましたか? '[self.params objectForKey:@" skills "]'とは何ですか?私は何が間違っているのか分かりません。 – Larme
@Larme私の友人、私は[objectForKey self.params: "スキル" @]ログインこの私を表示する:スキル=( { AA = ID; }、{ AA = asdasda;} ) – kasiri182