gpt4 book ai didi

ios - Parse PFSignUpViewController 的空电子邮件字段异常

转载 作者:行者123 更新时间:2023-12-01 16:38:14 25 4
gpt4 key购买 nike

我在 iOS 上使用 Parse 的内置注册 View Controller ,带有 PFSignUpViewController实例设置为使用 emailAsUsername .使用此设置,它将用户名正确设置为用户的电子邮件,但将电子邮件设置为空字符串。这是一个大问题,因为如果两个用户尝试使用相同的电子邮件注册,它也会引发异常。

我尝试将用户名复制到委托(delegate)方法中的电子邮件字段中 shouldBeginSignUp ,在填写注册字段后但在注册发生之前调用。由于某种原因,电子邮件仍设置为空字符串。

我也尝试过创建云代码 saveBefore在保存之前触发以更新电子邮件字段服务器端。但是 Parse 不允许在云代码中更新该字段——据说是因为它可能不是唯一的 :)

一种解决方法是在注册过程成功后立即将电子邮件设置为用户名,但如果两个注册几乎同时发生,这显然会失败。

最佳答案

两个PFLogInViewControllerPFSignUpViewController有一个名为 emailAsUsername 的属性.您可以简单地将其设置为 true .

Whether to prompt for the email as username on the login view. If set to YES, we’ll prompt for the email in the username field. This property value propagates to the attached signUpController. By default, this is set to NO.



引用文献链接:

https://parse.com/docs/ios/api/Classes/PFLogInViewController.html#/c:objc(cs)PFLogInViewController(py)emailAsUsername

https://parse.com/docs/ios/api/Classes/PFSignUpViewController.html#/c:objc(cs)PFSignUpViewController(py)emailAsUsername

关于ios - Parse PFSignUpViewController 的空电子邮件字段异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26446499/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com