AVURLAsset's loadValuesAsynchronouslyForKeys method doesn't call completion block when executed in modal view controller
I'm using AV Foundation to replay in-bundle .mov files. I followed Apple's guide to initiate an AVURLAsset instance and called its - (void)loadValuesAsynchronouslyForKeys:(NSArray *)keys completionHandler:(void (^)(void))handler method.
In the view controller loaded firstly, doing this works.
My app architecture adds modal view controllers on top of the base one, I found calling loadValuesAsynchronouslyForKeys in the following modal view controllers doesn't work well: the completion block handler has never got called.
I copy+paste the AV Foundation code shown below, so my thought is this code snippt doesn't work in modal view controllers, but why?
NSString *path = [[NSBundle mainBundle] pathForResource:@"video001" ofType:@"mov"];
NSURL *url = [NSURL fileURLWithPath:path isDirectory:NO];
AVURLAsset *asset = [AVURLAsset URLAssetWithURL:url options:nil];
[asset loadValuesAsynchronouslyForKeys:[NSArray arrayWithObjects:@"tracks", nil] com开发者_高级运维pletionHandler:^(void){
NSLog(@"compltion");
}];
精彩评论