Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xcode/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/email/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何检查PFUser是否已验证它';s电子邮件-Xcode解析_Xcode_Email_Parsing_Verify_Pfuser - Fatal编程技术网

如何检查PFUser是否已验证它';s电子邮件-Xcode解析

如何检查PFUser是否已验证它';s电子邮件-Xcode解析,xcode,email,parsing,verify,pfuser,Xcode,Email,Parsing,Verify,Pfuser,我正在尝试检查当前用户之前是否验证过它的电子邮件 他们继续下一步。我做错了什么请帮忙谢谢。后台储存的电话号码有效。。当我调用“SavePhoneInBackground”时,应用程序崩溃 (SVProgressHUd是活动指示器) 以下是我在最近的一个项目中使用的内容: - (BOOL)validateEmail:(NSString *)emailStr { NSString *emailRegex = @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{

我正在尝试检查当前用户之前是否验证过它的电子邮件 他们继续下一步。我做错了什么请帮忙谢谢。后台储存的电话号码有效。。当我调用“SavePhoneInBackground”时,应用程序崩溃

(SVProgressHUd是活动指示器)


以下是我在最近的一个项目中使用的内容:

- (BOOL)validateEmail:(NSString *)emailStr {
NSString *emailRegex = @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}";
NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailRegex];
return [emailTest evaluateWithObject:emailStr];
}
您还可以使用正则表达式的其他操作。当我使用此方法时,我遇到的问题是,项目将继续注册用户,同时仍显示我的自定义警报和NSLog错误,但这可能是我的失败,而不是该方法


希望这会把你带向正确的方向

以下是我在最近的一个项目中使用的内容:

- (BOOL)validateEmail:(NSString *)emailStr {
NSString *emailRegex = @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}";
NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailRegex];
return [emailTest evaluateWithObject:emailStr];
}
您还可以使用正则表达式的其他操作。当我使用此方法时,我遇到的问题是,项目将继续注册用户,同时仍显示我的自定义警报和NSLog错误,但这可能是我的失败,而不是该方法


希望这会把你带向正确的方向

这就是我在我的应用程序中所做的,它只允许经过验证的电子邮件用户访问。您需要根据需要对其进行轻微修改

- (void)logInViewController:(MyLogInViewController *)logInController didLogInUser:(PFUser *)user {

if (![[user objectForKey:@"emailVerified"] boolValue]){
    NSLog(@"User not validated email");
    [[[UIAlertView alloc] initWithTitle:@"Access restricted" message:@"To access this area please validate your email address" delegate:nil cancelButtonTitle:@"ok" otherButtonTitles:nil] show];
}
else if ([[user objectForKey:@"emailVerified"] boolValue]){
    NSLog(@"Email validated");
    [self dismissViewControllerAnimated:YES completion:NULL];
    [[[UIAlertView alloc] initWithTitle:@"Welcome back" message:(@"%@", user.username) delegate:nil cancelButtonTitle:@"ok" otherButtonTitles:nil] show];
}

// [self dismissViewControllerAnimated:YES completion:NULL];

NSLog(@"Login sucessfull and username is %@",user.username);
}


如果你还没有解决这个问题,希望这对你有所帮助

这就是我在我的应用程序中所做的,它只允许经过验证的电子邮件用户访问。您需要根据需要对其进行轻微修改

- (void)logInViewController:(MyLogInViewController *)logInController didLogInUser:(PFUser *)user {

if (![[user objectForKey:@"emailVerified"] boolValue]){
    NSLog(@"User not validated email");
    [[[UIAlertView alloc] initWithTitle:@"Access restricted" message:@"To access this area please validate your email address" delegate:nil cancelButtonTitle:@"ok" otherButtonTitles:nil] show];
}
else if ([[user objectForKey:@"emailVerified"] boolValue]){
    NSLog(@"Email validated");
    [self dismissViewControllerAnimated:YES completion:NULL];
    [[[UIAlertView alloc] initWithTitle:@"Welcome back" message:(@"%@", user.username) delegate:nil cancelButtonTitle:@"ok" otherButtonTitles:nil] show];
}

// [self dismissViewControllerAnimated:YES completion:NULL];

NSLog(@"Login sucessfull and username is %@",user.username);
func giveCaketoUser(user: PFUser) {
                if (user.objectForKey("emailVerified").boolValue == true){
                    println("true")
                } else {
                    println("flase")
                }
            }
}


如果你还没有解决这个问题,希望这对你有所帮助

当代码本身说明问题时,我认为不需要任何额外的信息细节:\^没错,就像:D语言很便宜。给我看一下代码-Linus Torvalds。当代码本身说明问题时,我认为不需要任何额外的信息细节:\^没错,就像:D语言很便宜。给我看看代码-Linus Torvalds。这篇文章与我现在遇到的一个问题有关。在我的例子中,没有emailVerified字段可以通过[PFUser currentUser](即使使用AllKey)获得,尽管它存在于服务器端。一些测试(连接到另一个服务器应用程序)似乎显示客户端正在工作,但我不知道我可能在服务器上错过了什么。这篇文章与我现在遇到的一个问题有关。在我的例子中,没有emailVerified字段可以通过[PFUser currentUser](即使使用AllKey)获得,尽管它存在于服务器端。一些测试(连接到另一个服务器应用程序)似乎显示客户端正在工作,但我不知道我可能在服务器上错过了什么。
func giveCaketoUser(user: PFUser) {
                if (user.objectForKey("emailVerified").boolValue == true){
                    println("true")
                } else {
                    println("flase")
                }
            }