【发布时间】:2013-03-26 07:20:32
【问题描述】:
当我尝试从以下位置更新主队列上的 UI 时收到内存警告:
- (void)captureOutput:(AVCaptureOutput *)captureOutput
didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
fromConnection:(AVCaptureConnection *)connection
委托方法是在 GCD 中的一个单独的串行队列上调用的,所以当我想从上述方法中分析的帧更新 UI 时,我调用:
long wait = dispatch_semaphore_wait(self.myUISemaphore, DISPATCH_TIME_FOREVER);
if(wait == 0)
{
dispatch_semaphore_signal(self.myUISemaphore);
dispatch_sync(dispatch_get_main_queue(), ^(void) {
self.numberFinderMarksLabel.text = [NSString stringWithFormat:@"%d", self.data];
});
}
如您所见,我尝试使用信号量无济于事。我尝试在调用 UI 后锁定线程并解锁,但这也不起作用。没有什么能阻止那些内存警告。五点左右之后,整个事情就无声无息地崩溃了。
【问题讨论】:
标签: xcode memory-management ios6 avfoundation grand-central-dispatch