简体   繁体   中英

No visible @interface for 'JSQSystemSoundPlayer' error

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM