Ios 使用AVAudioRecorder显示多条无法解释的错误消息
我正在为一个必须使用AVAudioRecorder的类(我正在学习Swift/iOS)的项目工作,在运行我的应用程序时,我在调试面板中收到以下错误消息(尽管该应用程序正在成功构建):Ios 使用AVAudioRecorder显示多条无法解释的错误消息,ios,swift,avaudiorecorder,Ios,Swift,Avaudiorecorder,我正在为一个必须使用AVAudioRecorder的类(我正在学习Swift/iOS)的项目工作,在运行我的应用程序时,我在调试面板中收到以下错误消息(尽管该应用程序正在成功构建): 你试过在设备上运行吗?我相信所有这些都只是模拟器消息,可以忽略。您能否分享您声明和使用AVAudioRecorder及其他AV相关组件的代码?不要管控制台消息。录音真的有用吗?应用程序中发生了什么不好的事情?录制工作(到目前为止),但是,我必须提交此项目进行审查,我担心这些消息会妨碍我的项目获得及格分数。如果可能的
你试过在设备上运行吗?我相信所有这些都只是模拟器消息,可以忽略。您能否分享您声明和使用AVAudioRecorder及其他AV相关组件的代码?不要管控制台消息。录音真的有用吗?应用程序中发生了什么不好的事情?录制工作(到目前为止),但是,我必须提交此项目进行审查,我担心这些消息会妨碍我的项目获得及格分数。如果可能的话,我想删除我的应用程序中的这些消息。
2020-08-09 20:28:41.073178+0200 MyAppName[49311:2895565] [plugin] AddInstanceForFactory: No factory registered for id <CFUUID 0x600002409fe0> F8BB1C28-BAE8-11D6-9C31-00039315CD46
2020-08-09 20:28:41.165556+0200 MyAppName[49311:2895565] PropertyID=1667788144 is NULL
2020-08-09 20:28:47.007202+0200 MyAppName[49311:2895894] [aqme] AQMEIO_HAL.cpp:1526:IOProc: AQDefaultDevice: Abandoning I/O cycle because reconfig pending (1).
import UIKit
import AVFoundation
class RecordSoundsViewController: UIViewController, AVAudioRecorderDelegate {
var audioRecorder: AVAudioRecorder!
@IBOutlet weak var recordingLabel: UILabel!
@IBOutlet weak var recordButton: UIButton!
@IBOutlet weak var stopRecordingButton: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
stopRecordingButton.isEnabled = false
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
print("viewWillAppear called")
}
@IBAction func recordAudio(_ sender: Any) {
print("The 'Record' button was pressed.")
recordingLabel.text = "Recording in Progress"
stopRecordingButton.isEnabled = true
recordButton.isEnabled = false
let dirPath = NSSearchPathForDirectoriesInDomains(.documentDirectory,.userDomainMask, true)[0] as String
let recordingName = "recordedVoice.wav"
let pathArray = [dirPath, recordingName]
let filePath = URL(string: pathArray.joined(separator: "/"))
let session = AVAudioSession.sharedInstance()
try! session.setCategory(AVAudioSession.Category.playAndRecord, mode: AVAudioSession.Mode.default, options: AVAudioSession.CategoryOptions.defaultToSpeaker)
try! audioRecorder = AVAudioRecorder(url: filePath!, settings: [:])
audioRecorder.delegate = self
audioRecorder.isMeteringEnabled = true
audioRecorder.prepareToRecord()
audioRecorder.record()
}
@IBAction func stopRecording(_ sender: Any) {
print("The 'Stop Recording' button was pressed.")
recordingLabel.text = "Tap to Record"
recordButton.isEnabled = true
stopRecordingButton.isEnabled = false
audioRecorder.stop()
let audioSession = AVAudioSession.sharedInstance()
try! audioSession.setActive(false)
}
func audioRecorderDidFinishRecording(_ recorder: AVAudioRecorder, successfully flag: Bool) {
print("The app has finished the recording.")
}
}