打印到了 1000+ 超过了10 分钟都没有 kill。请问是怎么回事呢?
```` objc
- (void)applicationDidEnterBackground:(UIApplication *)application {
[application beginBackgroundTaskWithExpirationHandler:^{
__block int i = 1;
dispatch_source_t timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, dispatch_get_main_queue());
dispatch_source_set_timer(timer, DISPATCH_TIME_NOW, 1ull * NSEC_PER_SEC, 0 * NSEC_PER_SEC);
dispatch_source_set_event_handler(timer, ^{
NSLog(@"%d",i);
i++;
if (i > 60*100 + 5) {
dispatch_source_cancel(timer);
}
});
dispatch_resume(timer);
}];
}
````
展开