我想用AVAudioRecorder
录制音频。
以下是代码:
-(void)recordButtonTouchDown {
_textLabel.backgroundColor = [UIColor clearColor];
_timer = [NSTimer scheduledTimerWithTimeInterval:0.05
target:self
selector:@selector(setVoiceImage)
userInfo:nil
repeats:YES];
}
-(void)setVoiceImage {
currentCount += 0.05f;
if (currentCount==50) {
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
}
}
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate)无效,为什么?
答案 0 :(得分:0)
在下面的语句中可能是浮点舍入错误,因为测试浮点数是否相等确实需要Epsilon value:
if (currentCount==50) {
请改为尝试:
if (currentCount >= 50.0f) {
确认:在if
语句中添加断点。