2

このコードがリリースプールのどこかでクラッシュしている理由を誰かが知っていますか(「eject」が呼び出された後)?AVPlayerクラスリファレンスで、「currentItem」プロパティが「retain」として宣言されていないことがわかりました。http://developer.apple.com/library/ios/documentation/AVFoundation/Reference/AVPlayer_Class/Reference/Reference.html#//apple_ref / doc / uid / TP40009530-CH1-SW21

AVPlayerクラスのバグですか、それとも別の場所に保持する必要がありますか?

ありがとう!

- (void) viewDidLoad {
    NSURL *url = [NSURL URLWithString:@"http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8"];
    playerItem = [[AVPlayerItem alloc] initWithURL:url];
    player = [[AVPlayer alloc] initWithPlayerItem:playerItem];
}

- (IBAction) eject {
    [player release];
    [playerItem release];
}
4

2 に答える 2

2

私は通常、これを使用してプレーヤーをセットアップします。

if (!self.player) {
    player = [[AVPlayer alloc] init];
    }

    [self.player replaceCurrentItemWithPlayerItem:[AVPlayerItem playerItemWithURL:videoURL]];
于 2011-01-19T19:16:35.943 に答える
0

AVPlayer は initWithPlayerItem: 関数に AVPlayerItem を保持しているため、AVPlayerItem でメモリ リークが発生している可能性があります。「currentItem」は読み取り専用プロパティであり、書き込み可能なプロパティ専用の「retain」にすることはできません。

于 2012-04-09T09:18:15.010 に答える