我正在使用下一个片段同步地加载值,所以加载 = NO 永远不会触发。我对 AVAssetExportSession exportAsynchronously 也有同样的问题。 这一切都不仅仅适用于设备。
NSDictionary *options = [NSDictionary dictionaryWithObject:[NSNumber numberWithBool:YES] forKey:AVURLAssetPreferPreciseDurationAndTimingKey];
AVURLAsset *asset = [AVURLAsset URLAssetWithURL:URL options:options];
NSArray *keys = [NSArray arrayWithObjects:@"duration", @"tracks", nil];
__block bool loading = YES;
[asset loadValuesAsynchronouslyForKeys:keys completionHandler:^(void) {
loading = NO;
}];
while (loading)[[NSRunLoop currentRunLoop] runUntilDate:[[NSDate date] dateByAddingTimeInterval:0.5]];
请帮忙!我的大脑正在融化。