我想更改警报附带的错误消息,当用户登录时发生错误。 我尝试过:
(void)signUpViewController:(PFSignUpViewController *)signUpController didFailToSignUpWithError :( NSError *)错误{ UIAlertController * alert = [UIAlertController alertControllerWithTitle:@memessage:error .debugDescription preferredStyle:UIAlertControllerStyleAlert]; UIAlertAction * ok = [UIAlertAction actionWithTitle:@OKstyle:UIAlertActionStyleDefault handler:nil]; [alert addAction:ok]; [self presentViewController:alert animated:YES completion:nil]; NSLog(@无法注册...%@,error.debugDescription); }日志看起来很好,但是警报控制器仍然是老一个对于记录,当电子邮件已经被使用时,它会显示电子邮件MyName ...而不是电子邮件MyEmail ...已经被使用。
你知道如何做吗?
编辑:
解决方案保罗,我的电子邮件地址显示在MyName的地方,你还有其他的东西。
此外,我一直在玩1.6,与这个答案2年前和另一个Parse开发人员的更新评论这里1年前。我想他们现在不觉得这是我们的优先事项。这并不能使我的答案正确,有人可能找到了一个解决方案,但是我将signUpViewController和您可以访问 self.signUpView.emailField.text 的所有内容传递你的UIAlertController。此外,他们的更改日志中没有任何内容。所以我的答案是,这不是直接可编辑的,但不觉得这是正确的答案。它只是看起来像你想要这个功能,你将必须与本地化的字符串或创建自己的注册/登录视图控制器,您可以访问 UITextFields 文本和您可以使用任何您希望的警报,自定义或其他方式
I would like to change the error message that comes with the alert, when an error occur when the user signs in. I tried with :
- (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); }the log appears well, but the alert controller is still the old one. For the record, when the email is already taken, it says "the email MyName ..." instead of "the email MyEmail... is already taken".
Would you know how to do this?
Edit :
解决方案Paul, my email address is showing up in place of the MyName, you have something else going on there.
Additionally, I have been playing around with this for 1.6 and found the same results as this answer 2 years ago and an updated comment from another Parse developer here 1 year ago. I guess they just don't find it a priority for us right now. This doesn't make my answer right, someone else may have found a solution, but I subclassed the signUpViewController and everything where you have access to self.signUpView.emailField.text to pass in your UIAlertController. Also, nothing is in their changelog about it. So my answer, is, it's not directly editable at this time, but don't feel like it's the right answer. It simply looks like if you want this functionality you will have to go with either localized strings or creating your own sign up /login view controllers where you have access to the UITextFields text and where you can use whatever alert you wish, custom or otherwise
更多推荐
在Parse注册后发生错误时如何更改警报消息?
发布评论