I'm using next snippet to loadValues synchronously, so loading = NO never fires. And I have the same problem with AVAssetExportSession exportAsynchronously. It's all not working only on device.
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]];
Please, help! My brain is melting.