Dinesh
Dinesh

Reputation: 81

Ios/iphone create/maintain websessions

How to do I create a web/server session by accessing the web server from ios / iphone. I have a app where I ask user for a username and password and using that information I want to login to a website using UIWebView and access the necessary information. Greatly aprreciate if you can answer my question.

Upvotes: 0

Views: 669

Answers (1)

    NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];


    NSString *userType = [[loginArray valueForKey:@"Home"] valueForKey:@"userlogin_type"];

    NSString *userLoginID = [[loginArray valueForKey:@"Home"] valueForKey:@"userlogin_id"];

    NSString *userPwd = [[loginArray valueForKey:@"Home"] valueForKey:@"userlogin_password"];


        //[prefs setObject:userPwd forKey:@"new_user_pwd"];

    [prefs setObject:userType forKey:@"userType"];

    [prefs setObject:userLoginID forKey:@"userLoginID"];



    [prefs synchronize];//important this line

by using this u can maintain the session by verify this objects.

if u use the facebook sdk then

use

if(facbookObj.isSessionValid){

//session valid

}

Upvotes: 1

Related Questions