内射老阿姨1区2区3区4区_久久精品人人做人人爽电影蜜月_久久国产精品亚洲77777_99精品又大又爽又粗少妇毛片

iOS密碼在進入后臺1小時后重新設置-創(chuàng)新互聯(lián)

廢話不多說了,直接給大家貼代碼了,具體代碼如下所示:

創(chuàng)新互聯(lián)公司是一家專注于成都網(wǎng)站建設、成都網(wǎng)站制作與策劃設計,薊州網(wǎng)站建設哪家好?創(chuàng)新互聯(lián)公司做網(wǎng)站,專注于網(wǎng)站建設10多年,網(wǎng)設計領域的專業(yè)建站公司;建站業(yè)務涵蓋:薊州等地區(qū)。薊州做網(wǎng)站價格咨詢:028-86922220

AppDelegate.m

#import "AppDelegate.h"
#import "ViewController.h"
@interface AppDelegate ()
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  // Override point for customization after application launch.
  //當程序在后臺停留超過60分的時候,密碼會置為空。
  //1小時后將密碼重新設置
  [self timeInterval];
  return YES;
}
- (void)applicationWillResignActive:(UIApplication *)application {
  // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
  // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}
- (void)applicationDidEnterBackground:(UIApplication *)application {
  //計算時間差
  [self backTime];
}
- (void)applicationWillEnterForeground:(UIApplication *)application {
  //1小時后將密碼重新設置
  [self timeInterval];
}
- (void)applicationDidBecomeActive:(UIApplication *)application {
  // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
- (void)applicationWillTerminate:(UIApplication *)application {
  //計算時間差
  [self backTime];
}
#pragma -mark -密碼保存1個小時
//計算時間差
- (void)timeInterval
{
  NSLog(@"---timeInterval----");
  //設置一個字符串的時間
  NSString * dateBackString = [[NSUserDefaults standardUserDefaults] objectForKey:@"backGroundTime"];
  NSLog(@"---dateBackString---%@",dateBackString);
  if ([dateBackString isEqual:[NSNull null]] || dateBackString==nil || dateBackString.length ==0) {
  }
  else
  {
    NSInteger time = [self getTimeInterval:dateBackString];
    if (time >= 60) {
      //1小時后將密碼清空
      NSUserDefaults *userInfoDefault=[NSUserDefaults standardUserDefaults];
      [userInfoDefault setObject:@"" forKey:@"login-password"];
      [userInfoDefault synchronize];
    }
  }
}
//1小時后將密碼重新設置
- (void)backTime
{
  NSLog(@"----backTime-----");
  //計算上報時間差
  NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
  [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
  //結(jié)束時間
  NSDate * currentdate = [NSDate date];
  NSString * currentDateString = [dateFormatter stringFromDate: currentdate];
  NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
  [userDefaults setObject:currentDateString forKey:@"backGroundTime"];
  [userDefaults synchronize];
}
//計算時間差
- (NSInteger)getTimeInterval:(NSString *)sendDateString
{
  NSInteger minute;
  if (sendDateString ==nil||sendDateString.length==0) {
  }
  else
  {
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    //結(jié)束時間
    NSDate * currentdate = [NSDate date];
    NSDate * currentDate = [dateFormatter dateFromString:[dateFormatter stringFromDate: currentdate]];
    NSDate * endDate = [dateFormatter dateFromString:sendDateString];
    //得到時間差
    NSTimeInterval time = [currentDate timeIntervalSinceDate:endDate];
    //    int days = ((int)time)/(3600*24);
    //    int hours = ((int)time)%(3600*24)/3600;
    //    minute = ((NSInteger)time)%(3600*24)/3600/60;
    minute = (NSInteger)time;
  }
  return minute;
}
@end

另外有需要云服務器可以了解下創(chuàng)新互聯(lián)建站www.rwnh.cn,海內(nèi)外云服務器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務器、裸金屬服務器、高防服務器、香港服務器、美國服務器、虛擬主機、免備案服務器”等云主機租用服務以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應用場景需求。

標題名稱:iOS密碼在進入后臺1小時后重新設置-創(chuàng)新互聯(lián)
文章分享:http://www.rwnh.cn/article32/dhhopc.html

成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站制作、自適應網(wǎng)站、面包屑導航移動網(wǎng)站建設、網(wǎng)站改版、用戶體驗

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都app開發(fā)公司
吉安县| 张掖市| 香港| 阿尔山市| 通州区| 连山| 龙口市| 陇川县| 岳阳县| 安福县| 呼伦贝尔市| 金门县| 安国市| 东至县| 综艺| 噶尔县| 肇东市| 东光县| 安溪县| 广平县| 哈巴河县| 聂荣县| 平和县| 方正县| 聊城市| 舟山市| 新晃| 北京市| 广饶县| 海宁市| 汉沽区| 凤冈县| 澳门| 碌曲县| 商南县| 湖南省| 木兰县| 平陆县| 司法| 呼和浩特市| 晋江市|