首页 > 代码库 > XMPPManager 解析

XMPPManager 解析

NSUserDefaults standardUserDefaults]; [defaults setObject:account forKey:kAccountKey]; [defaults setObject:pwd forKey:kPasswordKey]; [defaults setObject:domain forKey:kDomainKey]; //同步沙盒 [defaults synchronize]; } /** * 获取沙盒的帐号 * */ +(NSString *)account{ return [[NSUserDefaults standardUserDefaults] objectForKey:kAccountKey]; } /** * 获取沙盒的密码 * */ +(NSString *)password{ return [[NSUserDefaults standardUserDefaults] objectForKey:kPasswordKey]; } /** * 获取沙盒的域名 * */ +(NSString *)domain{ return [[NSUserDefaults standardUserDefaults] objectForKey:kDomainKey]; } /** * 从沙盒清除所有的用户登录信息 * */ +(void)removeAllLoginInfo{ NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; [defaults removeObjectForKey:kAccountKey]; [defaults removeObjectForKey:kPasswordKey]; [defaults removeObjectForKey:kDomainKey]; [defaults synchronize]; } /** * 获取用户登录状态 * */ +(BOOL)isLogin{ return [[NSUserDefaults standardUserDefaults] boolForKey:kIsLoginKey]; } /** * 设置用户登录状态 */ +(void)setLogin:(BOOL)login{ NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; [defaults setBool:login forKey:kIsLoginKey]; [defaults synchronize]; } @end

XMPPManager 解析