Which view function load after pop-up exit in iphone - iphone

I have a login screen which is saying "SingnIn" when user is clicking on that he getting a pop of facebook login screen.
I want that if somebody successfully logged in, I want to change SignIn text with their name. But I am not getting place where I should write that part of code. Which view function load again after pop screen exit.

If you implemented facebook connect and if you meant facebook login then after login you can write code in facebook delegate method.
- (void)session:(FBSession*)session didLogin:(FBUID)uid {
//Write code here for changing label for user name
}

Related

webview linkclicked

I have a webview loading a website with a html form. When the user has entered their login credentials and push submit-button the user is sent to a new view controller. I want to stop this from happening IF the user enters the wrong credentials. If the wrong credentials are entered the website adress remains the same. Can I somehow say:
if (navigationType == UIWebViewNavgiationTypeLinkClicked) {
if (url remains the same == alert view saying wrong credentials was entered.
if (url changes - perform segue to new view controller?
Let your controller implement UIWebViewDelegate. When you do that, a bunch of callbacks will be called at different phases of the web request. The one you probably want to implement is this one:
- (void)webViewDidFinishLoad:(UIWebView *)webView {
// Be sure to use mainDocumentURL, because any iframes on your form page will
// also trigger this callback
NSString *completedurl = webView.request mainDocumentURL.absoluteString;
// Let's assume you have your form url in the string property self.formurl
if ([completedurl isEqualToString:self.formurl]) {
// Display your alert view saying that the credentials were incorrect
} else {
// Perform segue to next controller
}
The whole solution is a bit scary though, because any other error page or whatever would
trick your app to believe that the user was successfully logged on. A better approach might
be to check the html contents of the webview for some significant string that the
successful-login-page contains. You can get the html body by calling:
NSString *yourHTMLSourceCodeString = [webView stringByEvaluatingJavaScriptFromString:#"document.body.innerHTML"];
Yet another approach is to look for a cookie in the webview that confirms the login.
Or even better, use a native login form, submit the login request with native code, using
AFNetworking or the standard http SDK methods, and check the response for success.

iPhone Popup dialog hidden behind UIActionSheet

I have a UIActionSheet that displays various buttons, one of which posts a tweet to Twitter. To do so, the app has to request permission to access the user's Twitter account that they set in the settings on iOS 5. The problem is this popup gets hidden behind the UIActionSheet, like so:
screenshot http://dl.dropbox.com/u/51070/actionsheet.png
How can I get it to show above the action sheet? I've also tried dismissing the action sheet through dismissWithClickedButtonIndex:animated before calling the tweet function, but this problem still occurred.
Thanks!
Try calling your tweet method like this:
[self performSelector:#selector(myTweetMethod) withObject:nil afterDelay:0.1];
This should give the action sheet enough time to dismiss before invoking the tweet code.

Proper viewController setup for iPhone with login and logout functionality

In developing my current iPhone application, I'm having issues handling the login, logout functionality of presenting views.
I'd like to have my application have the following flow, but I cannot seem to figure out the proper viewcontroller setup:
When a user is not logged in, a login screen is immediately presented. Upon a successful login, the main application is displayed. The main application is a TabBarController. When returning back to the application, if you have already logged in, the login window will not display, but immediately go into the main tab bar. Once in the app, you can "logout" and it will take you back to the login scren.
Please let me know if I need to go into further detail. There are a few other questions on here that are similar but not exactly what I'm looking for.
Thanks!
I would consider two ways of doing this:
have the login screen be a modal view controller that pops over the main UI.
e.g.
if (currentCredentials == nil) [self presentModalViewController:loginView animated:YES];
or alternately, handle switching between views using your app delegate.

fbconnect logout button iphone sdk

i have the default login button of fbconnect sdk . i tap it and i connect then i post to my facebook profile something. when the post is finished i see that the button has changed to logout . how can i detect when the user presses the logout button in order to dissapear another button i have on my uiview?
The obvious and easiest way is to know what is the status of the button. If the user is already loggined, the status of the button will say "Log out", and when user clicks on it, you just handling the event and call logout.
Now, how can you know that user is loggined? There is a method in FBConnect in FBSession classes.
[_session isConnected]; returns true if user is loggined and return false if user is not. And I think that you already have stored your session variable somewhere to call login

Data Formatters temporarily unavailable

I'm currently working on an iPhone app.
This app has a login screen, also a signup screen.
After the user has successfully signed up, I dismiss the signup view, then the app automatically logs in using the created account. After which, the login view is dismissed, showing the main view.
I'm trying to modify this by immediately dismissing the login view, since I already have the account details of the user when the signup is successful. Basically, the ideal flow is: after the user successfully signs up, I save the username and password in a singleton class, then dismiss the signup view. When I get to the parent view (which is the login screen), I have a variable that checks if there was a successful signup. If that variable is true, I want to immediately dismiss the login view.
However, I come across this error message: Data Formatters temporarily unavailable, will re-try after a 'continue'. (Unknown error loading shared library "/Developer/usr/lib/libXcodeDebuggerSupport.dylib")
I'm not really sure why this happens. I have no problems dismissing the login view when I go through the actual login procedure - which of course also dismisses the login view if the user inputs a correct username and password.
I'm not exactly sure, but I'm starting to think that the iPhone cannot handle dismissing 2 view controllers almost at the same time.
Is it possible that I'm dismissing the login view too quickly? Is that a factor? Is there anyway for me to be able to dismiss 2 view controllers almost simultaneously without coming across this error message?
It seems likely that dismissing 2 UIViewControllers at the same time is the cause of this error (I have seen it for various other reasons, including running short of memory).
Try a different flow, where you check for the saved values first, then load your main view if valid, or the login view if not. I do this in one app, and it works fine.