【发布时间】:2014-03-26 23:56:33
【问题描述】:
UIApplication *application = [UIApplication sharedApplication];
UIBackgroundTaskIdentifier background_task = 0;
background_task = [application beginBackgroundTaskWithExpirationHandler: ^{
[application endBackgroundTask:background_task];
}];
SEL selector = NSSelectorFromString(action);
timer = [NSTimer scheduledTimerWithTimeInterval:floatUpdateInterval target:self selector:selector userInfo:nil repeats:YES];
即使在 backgroundTimeRemaining 为 0(零)之后,上述代码(计时器)仍在运行。 这怎么可能?上述类型的方法不是最多 10 分钟吗?
上面的代码被认为是“应用商店”可以安全提交吗?
【问题讨论】:
-
我在 iOS 8 中也看到了这一点。“backgroundTimeRemaining”从 180 倒计时到 0,但后台线程继续运行。
-
你得到答案了吗?
-
您是否在后台执行其他操作,例如使用定位服务?
-
你检查过期处理程序被调用了吗?
-
我开启了定位服务,它也做同样的事情。不知道为什么??