每当我运行以下代码时,都可以很好地播放声音,但它总是将一些内容打印到控制台. 代码:
let path = Bundle.main.bundlePath
let task = Process()
task.launchPath = "/usr/bin/env"
task.arguments = ["afplay", path]
let _ = try? task.run()
task.waitUntilExit()
控制台消息:
2023-05-07 01:18:05.779125+0200 afplay[7755:301446] [plugin] AddInstanceForFactory: No factory registered for id <CFUUID 0x60000020c1c0> F8BB1C28-BAE8-11D6-9C31-00039315CD46
2023-05-07 01:18:05.799089+0200 afplay[7755:301446] [aqme] MEMixerChannel.cpp:1636 client <AudioQueueObject@0x10100f200; [0]; play> got error 2003332927 while sending format information
2023-05-07 01:18:06.554636+0200 afplay[7755:301448] [aqme] MEMixerChannel.cpp:1636 client <AudioQueueObject@0x10100f200; [0]; play> got error 2003332927 while sending format information
You are in First Layer spawn
我曾try 通过使用LaunchPath /usr/bin/clear
运行不同的进程来清除终端,但仍然不起作用