1. 退出登錄時(shí),保存用戶手機(jī)號(hào),以便下次登錄時(shí),直接帶出手機(jī)號(hào)
// 退出登錄時(shí),調(diào)用此方法,存當(dāng)前時(shí)間戳
- (void)saveDateMobileNoWhenLogout {
NSDate *logoutDate = [NSDate date];
NSDictionary *dict = @{kAppMobileNo:[JFUserInfoModel getMobileNo],
kAppLogoutDate:logoutDate};
[[WXLocalSettings sharedSettings] setSettings:dict forKey:kAppLogout];
}
2. 新建工具類(lèi),取出退出登錄時(shí)記錄的手機(jī)號(hào)
+ (NSString *)getMobileNoWhenLogin {
// 拿到退出登錄時(shí)的手機(jī)號(hào)和時(shí)間
NSDictionary *userLogout = [[WXLocalSettings sharedSettings] getSettings:kAppLogout];
NSDate *nowDate = [NSDate date];
NSDate *logoutDate = userLogout[kAppLogoutDate];
if (!logoutDate) {
return nil;
}
// 兩個(gè)時(shí)間戳的間隔 返回的是秒
NSTimeInterval time = [nowDate timeIntervalSinceDate:logoutDate];
if (time/60/60 >= 72) {
return nil;
}
else {
return userLogout[kAppMobileNo];
}
}
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。