简体   繁体   English

'JSQSystemSoundPlayer'错误没有可见的@interface

[英]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 如果您查看playSoundWithFilename: fileExtension: completion:方法的声明,则会发现

@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 如果您不想执行任何操作,则可以如上所述传递nil或empty块

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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