gpt4 book ai didi

ios - UISaveVideoAtPathToSavedPhotosAlbum 输出

转载 作者:技术小花猫 更新时间:2023-10-29 11:06:00 26 4
gpt4 key购买 nike

当我使用 UISaveVideoAtPathToSavedPhotosAlbum 在相册中保存视频时,如何在 assets-library://asset/asset.mov 中检索它的新 Assets URL....格式

//outputURL.path is : file:///private/var/mobile/Applications/4535724C-7ABD-4F00-A363-9A62022F8EB0/tmp/trim.E8CD7632-7C52-4EA4-A462-8C5131B214AA.MOV.exp.mov

UISaveVideoAtPathToSavedPhotosAlbum(outputURL.path, self, @selector(video:didFinishSavingWithError:contextInfo:), nil);

最佳答案

您可以使用 -[ALAssetsLibrary writeVideoAtPathToSavedPhotosAlbum:(NSURL *)videoPathURL completionBlock (ALAssetsLibraryWriteVideoCompletionBlock)completionBlock] 方法(Apple Documentation here)

代替 UISaveVideoAtPathToSavedPhotosAlbum >

例如:

ALAssetsLibrary* library = [[ALAssetsLibrary alloc] init];
[library writeVideoAtPathToSavedPhotosAlbum:videoPathURL
completionBlock:^(NSURL *assetURL, NSError *error)
{
/* process assetURL */
}];

重要说明:处理 ALAssetsLibrary 时要记住的重要一点是 assetURL 仅在 ALAssetsLibrary 实例的生命周期内有效。因此,请确保在完成对 assetURL 和任何关联的 ALAsset 的处理之前持有对库的引用。

关于ios - UISaveVideoAtPathToSavedPhotosAlbum 输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22128515/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com