gpt4 book ai didi

ios - 无法使用类型为 'addMutableTrackWithMediaType' 的参数列表调用 '(mediaType: String, preferredTrackID: Int)'

转载 作者:行者123 更新时间:2023-11-28 13:11:43 24 4
gpt4 key购买 nike

当我们尝试使用 AVMutableComposition 时,Xcode 抛出此错误:

Cannot invoke 'addMutableTrackWithMediaType' with an argument list of type  '(mediaType: String, preferredTrackID: Int)'

代码:

    let mixComposition = AVMutableComposition()
let videoTrack = mixComposition.addMutableTrackWithMediaType(mediaType: AVMediaTypeVideo, preferredTrackID: kCMPersistentTrackID_Invalid)

我们也尝试过:

    let mixComposition = AVMutableComposition()
let videoTrack = mixComposition.addMutableTrackWithMediaType(mediaType: "AVMediaTypeVideo", preferredTrackID: kCMPersistentTrackID_Invalid)

let mixComposition = AVMutableComposition()
let videoTrack = mixComposition.addMutableTrackWithMediaType(AVMediaTypeVideo, preferredTrackID: kCMPersistentTrackID_Invalid)

这些都不起作用,Google 也没有提供任何帮助。是什么导致了错误?

最佳答案

这更正了编译错误,尽管它为 preferredTrackId 使用了不同的值:

    var videoTrack = mixComposition.addMutableTrackWithMediaType(AVMediaTypeVideo, preferredTrackID: CMPersistentTrackID())

关于ios - 无法使用类型为 'addMutableTrackWithMediaType' 的参数列表调用 '(mediaType: String, preferredTrackID: Int)',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31039128/

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