繁体   English   中英

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

[英]No visible @interface for 'JSQSystemSoundPlayer' error

我刚刚添加了文件:

JSQSystemSoundPlayer.h
JSQSystemSoundPlayer.m

进入我的项目,它上升了下一个错误:

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

我进行了很多搜索,但找不到解决方案。 有人知道如何解决吗?

这是方法的声明

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

您缺少完成块,没有只有两个参数的方法

这是示例如何使用它

[[JSQSystemSoundPlayer sharedPlayer] playSoundWithFilename:@"mySoundFile"
                                             fileExtension:kJSQSystemSoundTypeAIF
                                                completion:^{
                                                  // completion block code
                                                }];

编辑:根据评论

如果您查看playSoundWithFilename: fileExtension: completion:方法的声明,则会发现

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

这意味着在声音停止播放后,您可以做任何想做的事情。 如果您不想执行任何操作,则可以如上所述传递nil或empty块

暂无
暂无

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

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