在 plist 中,我存储了凭据,我需要检查正确的凭据,如果正确的凭据匹配,则将密码字段替换为新的..为此我有 3 UITextField
。A 表示新的电子邮件 ID,b 表示当前密码,c 表示新密码 ..ifa==b
表示current password == email id
在 c 文本字段中输入的新密码应替换为 中的当前密码字段plist
。
- (void)authenticateCredentials {
NSMutableArray *plistArray = [NSMutableArray arrayWithArray:[self readFromPlist]];
for (int i = 0; i< [plistArray count]; i++)
{
id object = [plistArray objectAtIndex:i];
if ([object isKindOfClass:[NSDictionary class]]) {
NSDictionary *objDict = (NSDictionary *)object;
if ([[objDict objectForKey:@"pass"] isEqualToString:emailTextFeild.text] && [[objDict objectForKey:@"title"] isEqualToString:passwordTextFeild.text])
{
NSLog(@"Correct credentials");
// what should be the condition to replace current password to new password
}
NSLog(@"INCorrect credentials");
} else {
NSLog(@"Error! Not a dictionary");
}
}
}