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 8019379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T21:22:29+00:00 2026-06-04T21:22:29+00:00

At this point I’m pretty frustrated but I’m sure it is something I’m missing.

  • 0

At this point I’m pretty frustrated but I’m sure it is something I’m missing. In this code my segue to my new viewController is showing up after the rest of the function is executed. How do I get my viewController to be the code being executed? Basically stop the tweetText function from happening until that view is closed I’m trying to give the user an option to select a twitter account if there is more than one. I have tried many different ways. In Apples own example code they suggest to give the user an option but give nothing on how to do it without blowing through the rest of the code.

Here is the code:

 [accountStore requestAccessToAccountsWithType:accountType withCompletionHandler:^(BOOL granted, NSError *error) {

        if(granted) {
            dispatch_sync(dispatch_get_main_queue(), ^{
                // Get the list of Twitter accounts.
                self.accountsArray = [accountStore accountsWithAccountType:accountType];

                if([self.accountsArray count] > 1 /* Check method to see if preference is still a valid account */) {
                    // Display user accounts if no preference has been set
                    [self performSegueWithIdentifier:@"TwitterAccounts" sender:self.accountsArray];

                    [tweet tweetText:tweetString account:self.twitterAccount type:AchievementTweet];

                } else {
                    [tweet tweetText:tweetString account:[self.accountsArray lastObject] type:AchievementTweet];
                }
            });

        } else {
            [tweet performSelectorOnMainThread:@selector(displayText:) withObject:[NSNumber numberWithInt:403] waitUntilDone:NO];
        }
       }];
  • 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-04T21:22:30+00:00Added an answer on June 4, 2026 at 9:22 pm

    I am a little confused on what is your purpose but you got 2 options.

    There is really no need for GCD here.

    I would suggest to register for a notification which will perform your second action once your first action has been accomplished. (Similar to how apple handles the image picker, on their code they inform of when the picture has finally been saved to execute another function).

    The other way is using delegates, on this approach you would put the second part of the code on a separate function, then declare that controller as the delegate of the viewcontroller you want executed first, then after whatever you want acomplished is done on the viewcontroller you would ask the delegate to perform the second code and if necessary ask the delegate to close the view as well.

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

Sidebar

Related Questions

It's a theoretical question at this point in time, but something I'm probably going
This is going to be a pretty open ended question; but at this point
I have been stuck at this point for a long time and even after
I'm really quite frustrated at this point. I have an existing hg repository that
I am stuck at this point of code that I do not know how
Ok at this point, I am pretty confused on how to construct my pagination
Up until this point all the .NET remoting code I have written or worked
Up to this point I've avoided javascript, mostly because I'm a newbie. But I
This is becoming extremely frustrating at this point.. everything appears to be correct but
I've read many posts and blogs at this point and I'm still not sure

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.