-1
我想获取我的用户名和密码,我从我的服务器获取。我已经存储在jsondata
这是NSMutableArray
。不过,我只通过-objectAtIndex:
获得一个数据。我想打电话给我的字典里面的所有数据。我知道我必须使用NSIndexSet
,但我不知道使用它的正确方法。我正在使用for
循环。我无法访问我的密钥值来匹配用户凭据。有人可以提出任何建议吗?这是我的代码:如何使用NSDictionary访问来自JSON数据的所有索引集合
NSDictionary *dict = [jsondata objectAtIndex:0];
if ([username.text isEqualToString:[dict valueForKey:@"username"]]&&[password.text isEqualToString:[dict valueForKey:@"password"]]) {
username.text=nil;
password.text=nil;
[self performSegueWithIdentifier:@"login" sender:nil];
}
else {
UIAlertView *error=[[UIAlertView alloc]initWithTitle:@"Oooops" message:@"Login Credentials did`t Match" delegate:self cancelButtonTitle:@"ok" otherButtonTitles:nil];
[error show];
}
我不有任何特定的类在我的数据库就像临时或任何我有奥菱的用户名密码和ID,以及邮寄和他们本身的目录.. – moeen
温度是不是一类。它是id类型的对象。id类型是所有Objective-C对象的泛型类型。我使用它,因为我不知道jsondata包含的是什么。 –
使用此我得到单值gof用户名除此之外,我想所有的值来检查用户名是否匹配我的json数据{“id”:“44”,“用户名”:“moeen”,“密码” :“ahmad”,“emailid”:“[email protected]”},像dat很多字符串 – moeen