rak*_*hNS 16 iphone objective-c background-process ios objective-c-blocks
我厌倦了在目标C中搜索符号^的含义.我已经在许多项目中看到过它,尤其是在后台运行任务中.我将链接
http://developer.apple.com/library/ios/#samplecode/StitchedStreamPlayer/Introduction/Intro.html#//apple_ref/doc/uid/DTS40010092
,MyStreamingMovieViewController.m
你可以在里面找到以下内容 - (IBAction)endScrubbing:(id)sender method
.
timeObserver = [[player addPeriodicTimeObserverForInterval:CMTimeMakeWithSeconds(tolerance, NSEC_PER_SEC) queue:dispatch_get_main_queue() usingBlock:
^(CMTime time)
{
[self syncScrubber];
}] retain];
}
Run Code Online (Sandbox Code Playgroud)
- (void)applicationDidEnterBackground:(UIApplication *)application
{
UIApplication* app = [UIApplication sharedApplication];
bgTask = [app beginBackgroundTaskWithExpirationHandler:^{
// Clean up any unfinished task business by marking where you.
// stopped or ending the task outright.
[app endBackgroundTask:bgTask];
bgTask = UIBackgroundTaskInvalid;
}];
// Start the long-running task and return immediately.
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
// Do the work associated with the task, preferably in chunks.
[app endBackgroundTask:bgTask];
bgTask = UIBackgroundTaskInvalid;
});
}
Run Code Online (Sandbox Code Playgroud)
请让我知道答案.
归档时间: |
|
查看次数: |
17173 次 |
最近记录: |