Talk to an expert
June 13th, 2012
June 13th, 2012

    SIGN FOR NEWS

    sign for news

    Lorem ipsum dolor amet, consectetur adipiscing elit, sed do eiusmod tempor.


    In the previous post we showed off the code that allowed us to login into the Facebook and like a company. Here is the iOS version. 

    - (void)viewDidLoad {     
    [webview loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://m.facbook.com"]
    [super viewDidLoad]
    ]];

    ; } -(BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType{ NSURL *url = [request URL]; if([[url absoluteString] hasPrefix:@”https://m.facebook.com/home.php”]){ [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@”http://www.facebook.com/translucent.computing”]]]; } return YES; }
    The above code loads the Facebook login screen when the controller loads. After the user logs in the code redirects to the company website. This controller has only one outlet, UIWebview. The controller also implements the UIWebViewDelegate, shouldStartLoadingWithRequest is one of the delegate methods. We also added a header to the controller with a Facebook logout button that also closes the controller.

    0 0 votes
    Article Rating

    We treat your business like our own.

    Let's talk!
    0
    Would love your thoughts, please comment.x
    ()
    x