簡體   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