【发布时间】:2011-11-10 09:43:07
【问题描述】:
可能重复:
Caret in objective C
What does this ^ syntax mean in Objective-C?
我厌倦了在 Objective 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];
}
- (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;
});
}
请告诉我答案。
【问题讨论】:
-
@chx:与那个问题完全一样
-
@rakeshNS:符号
^被称为“插入符号”。如果您在 Google 中搜索“^ objective-c”,您将得不到有用的结果。如果你搜索“caret objective-c”,你会得到相当多的信息。 -
@JeremyP 我知道,我在找到它后将其标记为重复。
-
@JeremyP 感谢您的发现。事情就是这样发生的
标签: iphone objective-c ios objective-c-blocks background-process