Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8065123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T11:34:24+00:00 2026-06-05T11:34:24+00:00

I have a modal view that comes up requiring the user to verify his/her

  • 0

I have a modal view that comes up requiring the user to verify his/her email before continuing. This modal view can be presented from two different spots in the app. In one spot it comes from another modal view. This is my code for dismissing both modal views at once (works great).

MYUser *thisUser = [MyUser thisUser];
[thisUser refreshInBackgroundWithBlock:^(MyObject *thisUser, NSError *error) {
if (thisUser){
  if ([[thisUser objectForKey:@"emailVerified"] intValue]) {
    [self dismissViewControllerAnimated:YES completion:^{
      MyLoginViewController *controller = (MyLoginViewController *)self.presentingViewController;
      [controller verifiedEmail];
      }
    }];
  } else {
      NSLog(@"Not verified");
  }
} else {
    NSLog(@"%@", error);
  }
}];

The problem starts when I try to add a check incase it doesn’t come from another modal view. I have tried inserting this if statement into my dismissViewControllerAnimated:complete:^ block:

* if ([self.presentingViewController respondsToSelector:@selector(verifiedEmail)]){}
if ([self.presentingViewController isMemberOfClass:[MyLoginViewController class]]){}
* if ([self.presentingViewController class] == [MyLoginViewController class]){}

None of these work. They either fail (in the event of the *’d ones) or crash the app. I’m thinking the issue is because self.presentingViewController isn’t typecast, but if I NSLog(@"%@", [self.presentingViewController class]); and NSLog(@"%@", [MyLoginViewController class]);, the output looks identical.

Any ideas? Thanks.

EDIT WITH SOLUTION

It turns out that you cannot call self.presentingViewController inside the completion block because it is null at that point. I modified the code to this:

MYUser *thisUser = [MyUser thisUser];
id presentingVC = self.presentingViewController;
[thisUser refreshInBackgroundWithBlock:^(MyObject *thisUser, NSError *error) {
if (thisUser){
  if ([[thisUser objectForKey:@"emailVerified"] intValue]) {
    [self dismissViewControllerAnimated:YES completion:^{
    if ([presentingVC isMemberOfClass:[MyLoginViewController class]]){
      MyLoginViewController *controller = (MyLoginViewController *)presentingVC;
      [controller verifiedEmail];
      }
    }];
  } else {
      NSLog(@"Not verified");
  }
} else {
    NSLog(@"%@", error);
  }
}];

And it is now working wonderfully. Thanks for getting me pointed in the right direction!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T11:34:25+00:00Added an answer on June 5, 2026 at 11:34 am

    For anyone with similar problems @Mike_Z found a solution.

    It turns out that you cannot call self.presentingViewController inside
    the completion block because it is null at that point. I modified the
    code to this:

    MYUser *thisUser = [MyUser thisUser];
    id presentingVC = self.presentingViewController;
    [thisUser refreshInBackgroundWithBlock:^(MyObject *thisUser, NSError *error) {
    if (thisUser){
      if ([[thisUser objectForKey:@"emailVerified"] intValue]) {
        [self dismissViewControllerAnimated:YES completion:^{
        if ([presentingVC isMemberOfClass:[MyLoginViewController class]]){
          MyLoginViewController *controller = (MyLoginViewController *)presentingVC;
          [controller verifiedEmail];
          }
        }];
      } else {
          NSLog(@"Not verified");
      }
    } else {
        NSLog(@"%@", error);
      }
    }];
    

    And it is now working wonderfully. Thanks for getting me pointed in
    the right direction!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a modal view controller that I am presenting on iPad via: vc.modalPresentationStyle
I have a jquery modal dialog that displays a partial view. The partial view
I have a view model that looks like this public class ViewModelRound2 { public
I have a modal view controller that creates core data changes in it's own
I have a modal view controller whose view comes from a XIB. I want
i have a UIWebView on a modal view. The problem is that when the
I have a MVC3 view that enables the user to create a couple different
I have a view model that is displayed in a view that uses uploadify.
I have a view model that contains a Product class type and an IEnumerable<
I am using javascript unobtrusive validation. I have a view model that I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.