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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:02:31+00:00 2026-05-27T04:02:31+00:00

I’m experimenting with OAuth 2.0. which brings up a window containing a UIWebView as

  • 0

I’m experimenting with OAuth 2.0. which brings up a window containing a UIWebView as a canvas for the authentication server to communicate through. Right now, it is being shown as a modal view with its own view controller, and doesn’t have a back button or cancel button. So the user has no way to escape from the sign-in process.

I want to have the webView handled by a navigation controller so I can push the webView’s view controller.

I am having problems with doing this. It seems to me I should be able to just create a UINavigationController object with the root view controller being the main view controller, like this

UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:self];

However, this line crashes the program without any error message in the debugger.

I thought I could place a line to push the web view controller immediately after the line above, like this:

[navController pushViewController:windowController animated:YES];

But, without getting past the first line, I can’t begin to work out the details on getting the web view to show and then configure the back button.

UPDATE

Here is some context. This is in a single view application. The following code is in the main view controller, which brings up the sign-in dialog. I would like to replace the last line, where the presentModalViewController is called, with a push of the windowController onto a navController stack. Note the commented code at the end, where the initialization of the navigation controller is located.

- (IBAction)signInClicked:(id)sender {

    if (![self isSignedIn]) {
        // Sign in
        [self runSigninThenInvokeSelector:@selector(updateUI)];
    }

    [self updateUI];

}


- (void)runSigninThenInvokeSelector:(SEL)signInDoneSel {
    NSString *clientID = mClientId; 
    NSString *clientSecret = mClientSecret; 


    // Show the OAuth 2 sign-in controller
    NSString *scope = [GDataServiceGoogleBlogger authorizationScope];

      GTMOAuth2ViewControllerTouch *windowController;

    windowController = [[GTMOAuth2ViewControllerTouch controllerWithScope:(NSString *)scope
                                                                clientID:(NSString *)clientID
                                                            clientSecret:(NSString *)clientSecret
                                                        keychainItemName:(NSString *)kKeychainItemName
                                                                delegate:(id)self
                                                        finishedSelector:@selector(windowController:finishedWithAuth:error:)] retain];

    //UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:self];  // This causes a crash when it is not commented out.

    [self presentModalViewController:windowController animated:YES];

}

The application delegate didFinishLaunchingWithOptions is set up this way:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
    // Override point for customization after application launch.
    self.viewController = [[[blogSpotViewController alloc] initWithNibName:@"myNibName" bundle:nil] autorelease];
    self.window.rootViewController = self.viewController;

    [self.window makeKeyAndVisible];
    return YES;
}
  • 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-05-27T04:02:32+00:00Added an answer on May 27, 2026 at 4:02 am

    Well, you can present this as a modal controller. You just need to arrange to call dismissModalViewController: in response to a button or some other event on the ‘windowController’.

    But if you want to use a navigation controller, then you can set that up in application:didFinishLaunchingWithOptions: like so:

    // create window here like now
    
    blogSpotViewController *viewController = [[blogSpotViewController alloc] initWithNibName:@"myNibName" bundle:nil];
    
    UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:viewController];
    
    [viewController release];
    
    // TODO: hold onto this navController in a property if you really need that.
    
    self.window.rootViewController = navController;
    
    [navController release];
    
    // present window here as you are now
    

    This embeds your main view controller in a navigation controller. Then back in your runSigninThenInvokeSelector: you can…

    [self.navigationController pushViewController:windowController animated:YES];
    

    Hope that points you in the right direction.

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

Sidebar

Related Questions

this is what i have right now Drawing an RSS feed into the php,
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
I am trying to loop through a bunch of documents I have to put
That's pretty much it. I'm using Nokogiri to scrape a web page what has

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.