我收到此错误:


  /:“ JSQSystemSoundPlayer”没有可见的@interface声明了
  选择器'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 - 在Swift中使用Objective-C的JSQSystemSoundPlayer时,我看不到@interface,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/34261948/

10-09 02:13