0
我返回一個JSON像這樣無法正確deserialised。JSON在字典編碼字典在我的PHP後臺使用AFNetworking
現在我想要得到的用戶:
NSDictionary *user = (NSDictionary *)[results objectForKey:@"results"];
NSLog(@"%@",user);
[[API sharedInstance] setUser:user];
[self.navigationController popViewControllerAnimated:YES];
[self showAlertWithTitle:@"Logged in" andMessage:[NSString stringWithFormat:@"Welcome %@",[user objectForKey:@"username"]]];
應用崩潰與"NSInvalidArgumentException', reason: '-[__NSCFArray objectForKey:]: unrecognized selector sent to instance"
。我正在使用NSLog檢查「用戶」對象,我得到:
{ IdUser = 49; username = kenny; }
它仍然是JSON格式。我在這裏做錯了什麼?爲什麼不反序列化爲NSDictionary中的NSDictionary?
謝謝。我那裏的愚蠢。現在工作很好 – Kex