0
我正在爲iOS 4.3及更高版本編寫應用程序,並使用automatic reference counting
。我有一個使用AVPlayer
播放的視頻,並希望在達到給定的CMTime
時能夠暫停播放此視頻。我正在使用addBoundaryTimeObserverForTimes
並在block
內暫停AVPlayer
。它的工作原理,但我收到的錯誤:在給定CMTime處暫停AVPlayer
Capturing 'self' strongly in this block is likely to lead to a retain cycle
我的代碼:
timeObserver = [player addBoundaryTimeObserverForTimes:endTime //An array of one NSValue representing a CMTime
queue:NULL
usingBlock:^{
[player pause];
}];
我不能工作了這樣做的正確的方式將是任何幫助,非常感謝。
謝謝!
感謝weichsel。我不確定你的答案是否適用於我的情況...我可以在iOS 4.3中使用__weak嗎?無論如何,這是你提供的鏈接涵蓋,所以謝謝你! – Simple99 2012-01-18 11:09:48