ios-APP后台切前台token处理

Posted sayimba

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ios-APP后台切前台token处理相关的知识,希望对你有一定的参考价值。

/*
 APP从后台转前台调用的方法
 
 */
- (void)applicationDidBecomeActive:(UIApplication *)application {

    
    //获取本地保存的token
    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    NSString *string = [userDefaults objectForKey:@"login_token"];
    
    if (string != nil) {
        [self checkUserToken];
    }
    
    
}

-(void)checkUserToken
{

    //请求服务器,判断token是否过期
    [Common requestWithUrlString:upToken_url contentType:application_json errorShow:YES finished:^(id responseObj) {
        
        NSLog(@"%@",responseObj);
        
    } failed:^(NSString *errorMsg) {
        
        
    }];
    
}

 

以上是关于ios-APP后台切前台token处理的主要内容,如果未能解决你的问题,请参考以下文章