requestExportSessionForVideo null 错误 [英] requestExportSessionForVideo null error

查看:27
本文介绍了requestExportSessionForVideo null 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 requestExportSessionForVideo 方法从 PHAsset 获取可发送的视频,但我收到此警告,并且导出会话记录了一个空值:

I am using the requestExportSessionForVideo method to get a sendable video from a PHAsset, but I am getting this warning, and the export session logs a null value:

Null passed to a callee that requires a non-null argument

这里是方法调用:

[manager requestExportSessionForVideo:asset options:videoOptions exportPreset:AVAssetExportSessionStatusUnknown resultHandler:^(AVAssetExportSession * _Nullable exportSession, NSDictionary * _Nullable info) {
            NSLog(@"Export session is: %@ ///// Info is %@", exportSession, info);
        }];

打印的信息看起来不错:

The info that is printed looks good however:

Info is {
PHImageFileSandboxExtensionTokenKey = "8b504346993c71de48743d3c9c796385d7911ad2;00000000;00000000;000000000000001b;com.apple.avasset.read-only;00000001;01000002;00000000000468eb;/private/var/mobile/Media/DCIM/100APPLE/IMG_0004.MOV";
PHImageResultDeliveredImageFormatKey = 20000;
PHImageResultIsInCloudKey = 0;
PHImageResultWantedImageFormatKey = 20000;
}

如何从可以发送到云容器的 PHAsset 中获取视频对象?这个警告会影响输出吗?请注意,我的资产是使用 GMImagePicker 选择的.

How can I get a video object from a PHAsset that I can send to a cloud container? Will this warning affect the output? Please note my assets are selected using the GMImagePicker.

推荐答案

Swift - 在这里,使用 requestAVAssetForVideo 获取视频 url 的解决方案......它对我有用......

Swift - Here, solution for getting video url using requestAVAssetForVideo... its working for me ...

let options = PHVideoRequestOptions()
options.version = .Original
options.deliveryMode = .Automatic
options.networkAccessAllowed = true

PHCachingImageManager.defaultManager().requestAVAssetForVideo(asset, options: options, resultHandler:
                                {
                                    (avAsset, audioMix, info) in

                                    dispatch_sync(dispatch_get_main_queue(),{
                                        let theAsset = avAsset as! AVURLAsset
                                        let videoURL = theAsset.URL
                                        print(videoURL)

                                    })
                            })

这篇关于requestExportSessionForVideo null 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆