1

ファイルを追加しました:

JSQSystemSoundPlayer.h
JSQSystemSoundPlayer.m

私のプロジェクトに追加すると、次のエラーが発生しました:

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

私はたくさん検索しましたが、解決策を見つけることができませんでした。誰でもそれを解決する方法を知ることができますか?

4

1 に答える 1

4

メソッドの宣言です

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

完了ブロックがありません。パラメーターが 2 つしかないメソッドはありません

ここにそれを使用する方法の例があります

[[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、上記のようにブロックを渡すか空にすることができます

于 2015-08-05T12:03:53.580 に答える