- (void)applicationDidEnterBackground:(UIApplication *)application {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
NSLog(@"\n ===> 程序进入后台 !");
// [self beingBackgroundUpdateTask];
[[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:nil];
myTimer = [NSTimer scheduledTimerWithTimeInterval:10.0 target:self selector:@selector(tik) userInfo:nil repeats:YES];
}
- (void)tik{
if ([[UIApplication sharedApplication] backgroundTimeRemaining] < 61.0) {
//添加自己的代码
[[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:nil];
}
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
NSLog(@"\n ===> 程序进入后台 !");
// [self beingBackgroundUpdateTask];
[[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:nil];
myTimer = [NSTimer scheduledTimerWithTimeInterval:10.0 target:self selector:@selector(tik) userInfo:nil repeats:YES];
}
- (void)tik{
if ([[UIApplication sharedApplication] backgroundTimeRemaining] < 61.0) {
//添加自己的代码
[[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:nil];
}
}