我收到此错误:
/: 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 上修补了它:
关于objective-c - 在 Objective-C 中使用 Swift 中的 JSQSystemSoundPlayer 时,我没有看到可见的 @interface,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34261948/