1

I just added the files:

JSQSystemSoundPlayer.h
JSQSystemSoundPlayer.m

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?

Orkhan Alizade
  • 7,379
  • 14
  • 40
  • 79

1 Answers1

4

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"
                                             fileExtension:kJSQSystemSoundTypeAIF
                                                completion:^{
                                                  // 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

Community
  • 1
  • 1
Inder Kumar Rathore
  • 39,458
  • 17
  • 135
  • 184
  • Your solution worked...so thank you for that, but I don't understand what should go in the "completion block code" area. Can you lend some guidance? – Robert Sep 22 '15 at 02:33
  • i have added jsqMessageViewController and then it shows no jsqsoundsystemplayer file.....Then what i have to add.Only 2 files JSQSystemSoundPlayer.h and JSQSystemSoundPlayer.m i have to add or entire JSQSystemSoundPlayer folder.....suggest me @inder –  Apr 29 '16 at 10:12
  • @Raghunath it's `JSQSystemSoundPlayer` not `jsqsoundsystemplayer` or `JSQSoundSystemPlayer` – Inder Kumar Rathore Apr 29 '16 at 10:24
  • Just i have added `JSQSystemSoundPlayer.h` and `JSQSystemSoundPlayer.m` into my project.But it shows `JSQSystemSoundPlayer/JSQSystemSoundPlayer.h not found` in a category file JSQSystemSoundPlayer+JSQMessages.h. –  Apr 29 '16 at 10:29
  • @InderKumarRathore there?? –  Apr 29 '16 at 11:20
  • Please ask a new question for the same on Stackoverflow and explain what are you doing and what's your problem. – Inder Kumar Rathore Apr 29 '16 at 12:24