objective-cxcodeswiftjsqmessagesviewcontroller

I am getting no visible @interface while using JSQSystemSoundPlayer in Objective-C with Swift


I am getting this error:

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

I am creating a chat app with JSQMessagesViewController. Here is the code:

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

The error is on both, the if and the else statements. How do I fix this?


Solution

  • Hey not sure if you got it working yet or not, but you simply have to add a completion handler like so:

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

    I patched it on github if you don't feel like digging through the code:

    https://github.com/FridayDevGroup/JSQMessagesViewController