gpt4 book ai didi

ios - 选择器 'URLAssetWithURL' 没有已知的类方法

转载 作者:行者123 更新时间:2023-11-28 21:50:06 28 4
gpt4 key购买 nike

我有一个 iOS 应用程序,它使用应用程序中录制并保存的许多不同的音频文件。我已经导入了 AVFoundation 框架,但是我仍然收到错误:

No known class method for selector 'URLAssetWithURL'

这是我的代码:

AVAsset *asset = [AVURLAsset URLAssetWithURL:[NSURL URLWithString:audioFiles[indexPath.row]]];
waveformView.asset = asset;

audioFiles 数组内部是一个本地 URL,如下所示:

file:///var/mobile/Containers/Data/Application/6B35F9EA-1896-4989-91AF-06850B74B2E9/Documents/record_sound_1.aif

我做错了什么?

最佳答案

根据 https://developer.apple.com/library/mac/documentation/AVFoundation/Reference/AVURLAsset_Class/index.html 中的类引用

类方法有两个参数,URL 和一些选项。更改为:

AVAsset *asset = [AVURLAsset URLAssetWithURL:[NSURL URLWithString:audioFiles[indexPath.row]] options:nil];
waveformView.asset = asset;

我希望 XCode 的自动完成和突出显示能够明显表明您正在使用一种不存在的方法...

关于ios - 选择器 'URLAssetWithURL' 没有已知的类方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28639297/

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