呼び出されるたびにサウンドを再生するメソッドがあります。
- (void)play :(NSString *) fileName : (NSString *) extension
{
AUGraph theAUGraph;
...
AUGraphStart(theAUGraph);
...
[self performSelector:@selector(stopPlaying) withObject:theAUGraph afterDelay:5.0];
}
5 秒後、セレクターは stopPlaying メソッドを呼び出し、AUGraph オブジェクトを渡します。
-(void) stopPlaying: (AUGraph *) graph{
AUGraphStop(graph);
}
私がすぐに遭遇する問題は次のとおりです。
Implicit conversion of C pointer type 'theAUGraph' (aka 'struct OpaqueAUGraph *') to Objective-C pointer type 'id' requires a bridged cast.
提案された両方の修正を試しました:
[self performSelector:@selector(stopPlaying) withObject:(__bridge id)(theAUGraph) afterDelay:5.0];
と
[self performSelector:@selector(stopPlaying) withObject:CFBridgingRelease(theAUGraph) afterDelay:5.0];
しかし、実行時にEXC_BAD_ACCESSでクラッシュしました
私は混乱しています。どうすればオブジェクトを渡すことができますか?