我遇到AVAssetExportSession的问题,其中进度停止增加但状态仍然表示它正在导出.这实际上是一种非常罕见的情况,它在99.99%的时间内完美无瑕地运行,但无论如何我想解决这个问题.
所以我开始出口:
exportSession = [[AVAssetExportSession alloc] initWithAsset:composition presetName:AVAssetExportPresetMediumQuality];
exportSession.videoComposition = videoComposition;
exportSession.outputFileType = @"com.apple.quicktime-movie";
exportSession.outputURL = outputURL;
[exportSession exportAsynchronouslyWithCompletionHandler:^{
...
}];
Run Code Online (Sandbox Code Playgroud)
然后有一个计时器检查进度:
AVAssetExportSessionStatus status = [exportSession status];
float progress = 0;
if (status == AVAssetExportSessionStatusExporting) {
progress = [exportSession progress];
} else if (status == AVAssetExportSessionStatusCompleted) {
progress = 1;
}
NSLog(@"%d %f", status, progress);
[delegate processor:self didProgress:progress];
Run Code Online (Sandbox Code Playgroud)
输出最终看起来像:
2012-05-23 14:28:59.494 **********[1899:707] 2 0.125991
2012-05-23 14:28:59.994 **********[1899:707] 2 0.185280
2012-05-23 14:29:00.494 **********[1899:707] 2 0.259393
2012-05-23 14:29:00.994 **********[1899:707] 2 0.326093
2012-05-23 …Run Code Online (Sandbox Code Playgroud) 我正在泄漏我的注释.有问题的代码(剥离到最低限度)是:
- (void)updateLocations:(NSArray *)result {
[mapView removeAnnotations:locations];
[locations removeAllObjects];
[allLocations removeAllObjects];
for (NSDictionary *location in result) {
LocationAnnotation *annote = [[LocationAnnotation alloc] initWithInfo:location];
[allLocations addObject:annote];
[annote release];
}
[self updateAnnotations];
}
- (void)filterLocations {
for (LocationAnnotation *annote in allLocations) {
if (annote.typeFlag & filterFlags) {
[locations addObject:annote];
}
}
}
- (void)updateAnnotations {
[self filterLocations];
[mapView addAnnotations:locations];
}
- (void)updateFilter {
[mapView removeAnnotations:locations];
[locations removeAllObjects];
[self updateAnnotations];
}
Run Code Online (Sandbox Code Playgroud)
allLocations是一个包含所有注释的数组(它们不一定在地图上),并且locations是一个数组,用于保存实际显示在地图中的位置.当updateLocations:被调用时,添加到地图的注释中的一些(或全部,它从测试变为测试)都在泄漏.注释的分配历史记录是:
# Category Event Type Timestamp RefCt …Run Code Online (Sandbox Code Playgroud)