views:

171

answers:

2

After a login screen which sends the username/password to a webservice and gets back a response of either true(which is supposed to start the rest of the app) or false(incorrect username/password or unauthorized). The app gives the alert view that you are authenticated but it doesnt load the rest of the view?

Can anyone please help me?????????

if ([soapResults isEqualToString: @"true"])
    {
            UIAlertView *welcome = [[UIAlertView alloc] initWithTitle:@"Welcome!" message:@"Welcome, You are now authenticated to a Coyote Logistics application." delegate:self cancelButtonTitle:@"OK",nil otherButtonTitles:nil];
    [welcome show];
            [welcome release];
            [soapResults release];
            soapResults = nil;
            [loginIndicator stopAnimating];
            loginIndicator.hidden = TRUE;
            loggedinLabel.text = usernameField.text;
            loggedinLabel.textColor = [UIColor blackColor];
            NSLog(@"Valid Login"); 
            FeedsViewController *fvController = [[FeedsViewController alloc] initWithTitle:@"LoadBoard" withNavigationTitle:@"Available Loads" withPropertyFile:@"feeds.plist"];
            AboutViewController *avController = [[AboutViewController alloc] init];
            SettingsViewController *svController = [[SettingsViewController alloc] init];
            UINavigationController *fvNavController = [[UINavigationController alloc] initWithRootViewController:fvController];
            UINavigationController *avNavController = [[UINavigationController alloc] initWithRootViewController:avController];
            UINavigationController *svNavController = [[UINavigationController alloc] initWithRootViewController:svController];
            UITabBarController *tbController = [[UITabBarController alloc] init];

            fvNavController.navigationBar.tintColor = [UIColor colorWithRed:0.14 green:0.18 blue:0.25 alpha:1.00];
            avNavController.navigationBar.tintColor = [UIColor colorWithRed:0.14 green:0.18 blue:0.25 alpha:1.00];
            svNavController.navigationBar.tintColor = [UIColor colorWithRed:0.14 green:0.18 blue:0.25 alpha:1.00];


            [[fvController tabBarItem] setImage:[UIImage imageNamed:@"rss.png"]];

            tbController.viewControllers = [NSArray arrayWithObjects:fvNavController, avNavController, svNavController, nil];

            // Configure and show the window
            [window addSubview:tbController.view];
            [window makeKeyAndVisible];
            [LoginViewController release];
    }
A: 

What do you mean "stuck" are you using gdb to figure out where you're "stuck"? Is your app crashing? Did you do a backtrace? I also don't see any kind of NSURLRequest or anything connecting to a remote server in your pasted code.

apphacker
Sorry if I wasn't clear enough, I have it making a request and receiving an answer just fine. What i need it to do is when it receives a value of yes, it needs to launch all of this into the main app. It does that for customer security so that only authorized users can access the application
soapResults is the end string from the webservice. True would indicate a successful authorization.
A: 

First, if you're doing this in the app delegate method applicationDidFinishLaunching, I'd recommend you don't.

Why? Because if you take too long inside of that delegate method, the iPhone OS will shut you down and quit the app.

Have you considered having the nav controllers ready to go within the tab controller, and using a modal for the login?

When you get a success back, then you can dismiss the modal and proceed, filling in the data in the nav controller(s).

Still, though, if you're in the applicationDidFinishLaunching delegate method, just create the view controller and pose it modally so that control can return to the UIApplication object.

God of Biscuits