ios - Store Value in NSUser Default -


this code perform ...

 nsdictionary *dictionary = [nsjsonserialization jsonobjectwithdata:responseobject options:kniloptions error:&error];           [[nsuserdefaults standarduserdefaults] setobject:[dictionary objectforkey:@"user_id"] forkey:@"user_id"];           [[nsuserdefaults standarduserdefaults] synchronize];    nslog(@"%@",[[nsuserdefaults standarduserdefaults] objectforkey:@"user_id"]); 

and here json response

{     "flag": "true",     "message": "success",     "data": [         {             "username": "ankurk",             "user_id": "16",             "email": "ankurk.psk@gmail.com"         }     ] } 

but stuck store value user id in user default 1 please me happen here ?

thank

nsdictionary *dictionary = [nsjsonserialization jsonobjectwithdata:responseobject options:kniloptions error:&error]; nsarray *array = [dictionary objectforkey:"data"]; nsdictionary *datadictionary=[array objectatindex:0];  [[nsuserdefaults standarduserdefaults] setobject:[datadictionary objectforkey:@"user_id"] forkey:@"user_id"]; [[nsuserdefaults standarduserdefaults] synchronize]; 

Comments

Popular posts from this blog

searchKeyword not working in AngularJS filter -

sequelize.js - Sequelize: sort by enum cases -

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -