Objective c 应用程序处于后台模式时更改ios5设备亮度
我想通知用户某个事件被触发,以便我使用亮度 [UIScreen mainScreen]。亮度=1.0//0.0或者Objective c 应用程序处于后台模式时更改ios5设备亮度,objective-c,ios5,Objective C,Ios5,我想通知用户某个事件被触发,以便我使用亮度 [UIScreen mainScreen]。亮度=1.0//0.0或者 当应用程序处于前台模式时工作正常,但 当应用程序处于后台模式且该事件在该时间触发时,我的代码不工作。 我使用了位置,所以我的应用程序可以在后台运行 给我一些建议,当应用程序处于背景模式时,如何设置亮度 - (void)applicationDidEnterBackground:(UIApplication *)application { // UIBackgroundTas
当应用程序处于前台模式时工作正常,但 当应用程序处于后台模式且该事件在该时间触发时,我的代码不工作。 我使用了位置,所以我的应用程序可以在后台运行 给我一些建议,当应用程序处于背景模式时,如何设置亮度
- (void)applicationDidEnterBackground:(UIApplication *)application
{
// UIBackgroundTaskIdentifier *bgTask = nil;
UIApplication *app = [UIApplication sharedApplication];
counterTask = [[UIApplication sharedApplication]
beginBackgroundTaskWithExpirationHandler:^{
[app endBackgroundTask:counterTask];
counterTask = UIBackgroundTaskInvalid;
// If you're worried about exceeding 10 minutes, handle it here
theTimer=[NSTimer scheduledTimerWithTimeInterval:20
target:self
selector:@selector(YourFunction)
userInfo:nil
repeats:YES];
}];
count=0;
theTimer=[NSTimer scheduledTimerWithTimeInterval:20
target:self
selector:@selector(YourFunction)
userInfo:nil
repeats:YES];
//[super viewDidLoad];
}