ios - Play Audio Player when location speed decreases -


how play audioplayer when location speed greater 20,count time start 5 second , when location speed (speed decrease 20 t0 0)equal 0 play audio player.i try nothing happend plz me.here code

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];     } } 

your condition check not play audio. make changes given,

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];      }     else if (location.speed ==0) {         [audioplayer play];     }  }  -(void)dothis{ if(i %5 == 0)      {     [clcontroller.locmgr startupdatinglocation]; } } 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -