gpt4 book ai didi

objective-c - 在 Objective-C 中使用 Swift 中的 JSQSystemSoundPlayer 时,我没有看到可见的 @interface

转载 作者:行者123 更新时间:2023-11-30 10:08:58 26 4
gpt4 key购买 nike

我收到此错误:

/: No visible @interface for 'JSQSystemSoundPlayer' declares the selector 'playAlertSoundWithFilename:fileExtension:'

我正在使用 JSQMessagesViewController 创建一个聊天应用程序。这是代码:

if (asAlert) {
[[JSQSystemSoundPlayer sharedPlayer] playAlertSoundWithFilename:fileName fileExtension:kJSQSystemSoundTypeAIFF];
}
else {
[[JSQSystemSoundPlayer sharedPlayer] playSoundWithFilename:fileName fileExtension:kJSQSystemSoundTypeAIFF];
}

if 和 else 语句均出现错误。我该如何解决?

最佳答案

嘿,不确定您是否已经正常工作,但您只需添加一个完成处理程序,如下所示:

if (asAlert) {
[[JSQSystemSoundPlayer sharedPlayer] playAlertSoundWithFilename:fileName fileExtension:kJSQSystemSoundTypeAIFF completion:nil];

} else {
[[JSQSystemSoundPlayer sharedPlayer] playSoundWithFilename:fileName fileExtension:kJSQSystemSoundTypeAIFF completion:nil];
}

如果你不想深入研究代码,我在 github 上修补了它:

https://github.com/FridayDevGroup/JSQMessagesViewController

关于objective-c - 在 Objective-C 中使用 Swift 中的 JSQSystemSoundPlayer 时,我没有看到可见的 @interface,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34261948/

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