[manager POST:urlString parameters:[self jsonDict] success:^(AFHTTPRequestOperation *operation, id responseObject){
NSLog(@"response data: %@", responseObject);
NSArray *postFromResponse = [ responseObject valueForKeyPath:@"credentials"];
NSLog(@"credentials:%@", postFromResponse);
for(NSDictionary *object in postFromResponse)
{
NSString *AccessKeyId = [object valueForKeyPath:@"AccessKeyId"];
NSLog(@"%@", AccessKeyId);
}
}
に応答オブジェクトをキャストする方法:それは私にエラーを与える方法を対象
Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<__NSCFString 0x79ea4430> valueForUndefinedKey:]: this class is not key value coding-compliant for the key AccessKeyId'
'(postFromResponseでNSDictionaryの*オブジェクト)のために': 'postFromResponse'はそう'NSString'オブジェクトだけでなく、' NSString'オブジェクトも(すべてではないにしても) 'NSString'オブジェクトを持つようにします。そのため、 'object'が' NSString'の場合、 'valueForKeyPath'を呼び出すことができません。それとも、 'responseObject'が' NSString'ではなく 'NSDictionary'ですか?どのラインが問題を引き起こしているのかは明らかではなく、JSONが助けてくれることを示しています。 – Larme
私の応答は:credentials = {AccessKeyId = abac; SecretAccessKey = "99"; SessionToken = "rt"; }; – san
あなたの質問を更新(編集)し、 'postFromResponse'や' responseObject'の値であるかどうかを指定してください。 – Larme