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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T01:05:46+00:00 2026-05-14T01:05:46+00:00

On iPhone, how do I show a login screen to get username and password

  • 0

On iPhone, how do I show a login screen to get username and password before giving access to iPhone app? Also, does the iPhone store a cookie to the secure website like a web browser?

I was thinking of giving users to my website a long API key to store in the settings of their iPhone instead of asking them to login with a username/password (seems to be the Slicehost iPhone app approach.) Which is the best way to get a user to login securely? I have full control over the design of the iPhone app and website so have a lot of flexibility.

  • 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-14T01:05:47+00:00Added an answer on May 14, 2026 at 1:05 am

    I have this need in a couple of apps, and I use the following pattern:

    In the controller for the first view that gets presented to the user, I have the following test, where UserPrefsManager is a singleton that knows the user credentials. This call causes a modal view to appear (FirstTimeWelcomeViewController) which tells the person that they need to register.

    - (void)viewDidAppear:(BOOL)animated {
        [super viewDidAppear:animated];
        UserPrefsManager * prefs = [UserPrefsManager sharedInstance];
        if (![prefs isLoggedIn])
        {
            FirstTimeWelcomeViewController * vc = [[[FirstTimeWelcomeViewController alloc] initWithNibName:@"FirstTimeWelcomeViewController" bundle:nil] autorelease];
            [self presentModalViewController:vc animated: false];
        }
        else 
        {
            if (![[RWXLocationSingleton sharedInstance] hasLocation]) {
                [[RWXLocationSingleton  sharedInstance] findLocationWithAccuracy:kCLLocationAccuracyThreeKilometers withObject:self andSelector:@selector(updateLocationsView)];
            }
            [[self tableView ]reloadData];
        }
    }

    FirstTimeWelcomeViewController is basically a screen with buttons that greets people and takes them to the various ways to log in:

    -(IBAction) createAccount
    {       
        UIViewController * parent = [self parentViewController];
        CreateAccountViewController * vc = [[[CreateAccountViewController alloc] initWithNibName:@"CreateAccountViewController" bundle:nil] autorelease];
        [self dismissModalViewControllerAnimated:false];
        [parent presentModalViewController:vc animated: false];
    }

    imagine that these also exist for forgotPassword, and loginACcount… same pattern. This causes the current view to be replaced by a view handling the specific case that they’ve pressed the button for.

    taking the ‘loginAccount’ method, you’ve opened the LoginAccountViewController, and it has a method called loginButton, which works something like this…

    -(IBAction) loginButton
    {
        NSString * u = [self.username text];
        NSString * p = [self.password text];
    
            //
            // app specific logic that tests various inputs and creates a user object.
            //
            // goes here...
            //
    
            if([user checkValid])
        {
           UserPrefsManager * prefs = [UserPrefsManager sharedInstance];
           [prefs setPassword:p];
           [prefs setUsername:u];
           [self dismissModalViewControllerAnimated:FALSE];
        }
            //
            // more app specific stuff
            //
    }
    
    

    And that’s pretty much that. You have to use one of the standard ways for putting stuff in the keychain or user defaults to save your information. check that the one you pick lasts between restores if it is something that is annoying for the user to recreate. The first part is the most useful bit, thought the rest might be useful for context.

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

Sidebar

Related Questions

I am writing an app and I want to show the login screen just
Possible Duplicate: show a login screen before Tab bar controller? i am designing an
Possible Duplicate: show a login screen before Tab bar controller? i am designing an
I'd like to show an image in an iPhone app, but the image I'm
Does any one know how to show the numbers keyboard in the iphone rather
how to handle error in an iphone app ? log and exit ? show
i developing an iphone app with login to mysql db by php api ,
iPhone code When I use this code it always show error password but I
I am making a iPhone app with a login feature. After they login, I
i'm working on an iphone project and i have to show a login view

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.