当用户登录时发生错误时,我想更改警报附带的错误消息。
我试过:
- (void)signUpViewController:(PFSignUpViewController *)signUpController didFailToSignUpWithError:(NSError *)error {
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"me" message:error.debugDescription preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *ok = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:nil];
[alert addAction:ok];
[self presentViewController:alert animated:YES completion:nil];
NSLog(@"Failed to sign up... %@ ", error.debugDescription);
}
日志看起来很好,但警报 Controller 仍然是旧的。 作为记录,当电子邮件已被占用时,它会显示“电子邮件 MyName ...”而不是“电子邮件 MyEmail ... 已被占用”。
你知道怎么做吗?
编辑:
最佳答案
Paul,我的电子邮件地址显示在 MyName 的位置,你那里还有其他事情要发生。
此外,我在 1.6 中一直在研究这个,发现与 this answer 2 years ago 相同的结果。以及来自另一位 Parse 开发人员的更新评论 here 1 year ago .我猜他们只是觉得它现在不是我们的优先事项。这并不能使我的答案正确,其他人可能已经找到了解决方案,但我将 signUpViewController 和您有权访问 self.signUpView.emailField.text
的所有内容子类化以传递您的 UIAlertController。此外,他们的 changelog 中没有任何内容。关于它。所以我的回答是,目前不能直接编辑,但不要觉得这是正确的答案。看起来,如果您想要此功能,您将不得不使用本地化字符串或创建您自己的注册/登录 View Controller ,您可以在其中访问 UITextFields
文本并可以在其中使用任何警报您希望,定制或其他方式
关于ios - 在 Parse 中注册后发生错误时如何更改警报消息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28484027/