Hello I am saving values when user successfully login.
case 200:
let prefs:NSUserDefaults = NSUserDefaults.standardUserDefaults()
prefs.setObject(email, forKey: "EMAIL")
prefs.setObject(result["User"]!["profile_image"], forKey: "PROFILEIMAGE")
prefs.setObject(result["User"]!["first_name"], forKey: "FIRSTNAME")
prefs.setObject(result["User"]!["last_name"], forKey: "LASTNAME")
prefs.setObject(result["User"]!["Country"], forKey: "COUNTRY")
prefs.setObject(result["User"]!["user_id"], forKey: "USERID")
prefs.setObject(result["User"]!["session_token"], forKey: "SESSIONTOKEN")
prefs.setInteger(1, forKey: "ISLOGGEDIN")
prefs.synchronize()
dispatch_async(dispatch_get_main_queue(), { () -> Void in
let nav : SWRevealViewController = self.storyboard!.instantiateViewControllerWithIdentifier("swrevealviewcontroller") as! SWRevealViewController
self.navigationController?.presentViewController(nav, animated: true, completion: { () -> Void in
})
})
break;
I am getting the PROFILEIMAGE
value nil when I try to get the value like this
let userDefaults : NSUserDefaults = NSUserDefaults.standardUserDefaults()
print("userdefault is \(userDefaults.stringForKey("PROFILEIMAGE"))")
So In order to check all the keys and values stored in the phone I did this
print(NSUserDefaults.standardUserDefaults().dictionaryRepresentation())
I checked the console and I don't find COUNTRY
and PROFILEIMAGE
key and values in console
Please help me what I am doing wrong here