How to export PHAsset video by UIActivityViewController in iOS

后端 未结 2 941
生来不讨喜
生来不讨喜 2021-01-03 14:50

I tried to export PHAsset Video by UIActivityViewController in iOS. It worked fine when PHAsset was image. The problem was when PHAsset

2条回答
  •  滥情空心
    2021-01-03 15:08

    You shouldn't attach the AVURLAsset itself, instead you should specify its URL of the AVURLAsset as the activityItems.

    So, use avAsset.URL should work, avAsset is an instance object of type AVURLAsset.

    Edit

    let theAsset = avAsset as AVURLAsset
    let videoURL = theAsset.URL
    var activityVC = UIActivityViewController(activityItems: [videoURL], applicationActivities: nil)
    

提交回复
热议问题