Make RDTRecord
the delegate of the audio recorder and have it implement audioRecorderDidFinishRecording:successfully:
. But, also give it a property @property (assign) id <AVAudioRecorderDelegate> delegate;
and, when your view controller wants to trigger a recording have it set itself as the delegate of RDTRecord
.
Now, when audioRecorderDidFinishRecording:successfully:
is called in RDTRecord
it can forward the callback to its delegate:
- (void)audioRecorderDidFinishRecording:(AVAudioRecorder *)sharedRecorder successfully:(BOOL)flag
{
[self.delegate audioRecorderDidFinishRecording:sharedRecorder successfully:flag];
}
(you could also add the delegate as a parameter of doRecordAudio:
, and nil
the delegate
after the callback has run depending on your other requirements).
The view controller should remove itself as a delegate when it is done (and before it is destroyed).