Orkhan Alizade Orkhan Alizade - 5 months ago 26x
Swift Question

No visible @interface for 'JSQSystemSoundPlayer' error

I just added the files:


into my project and it rose the next error:

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

I searched a lot but could'n find the solution. Can anyone know how to solve it?


This is the declaration of the method

- (void)playAlertSoundWithFilename:(NSString *)filename
                 fileExtension:(NSString *)fileExtension
                    completion:(nullable JSQSystemSoundPlayerCompletionBlock)completionBlock;

You're missing completion block, there is no such method with only two parameters

Here is example how to use it

[[JSQSystemSoundPlayer sharedPlayer] playSoundWithFilename:@"mySoundFile"
                                                  // completion block code

Edit: As per comments

If you look at the declaration of playSoundWithFilename: fileExtension: completion: method you will find

@param completionBlock A block called after the sound has stopped playing.

Which means do whatever you want to do after the sound has stopped playing. If you don't want to do anything then either you can pass nil or empty block as above