場所の速度が20を超える場合にオーディオプレーヤーを再生する方法、カウント時間が5秒間開始され、突然場所の速度(速度が20 t0 0から減少)がゼロに等しい場合、オーディオプレーヤーが再生されます.これを試してみましたが、何も起こりませんでした.私のコード
int i;
- (void)locationUpdate:(CLLocation *)location{
speedLabel.text = [NSString stringWithFormat:@"%.2fmph",[location speed]*2.236936284];
if (location.speed >= 10)
{
[self performSelector:@selector(doThis) withObject:nil afterDelay:5];
if (location.speed ==0) {
[audioPlayer play];
}
}
}
-(void)doThis{
if(i %5 == 0)
{
[CLController.locMgr startUpdatingLocation];
}
}