timing - iOS - Program method to execute specific code according to time on the phones clock -


is possible execute code when specific time reached on iphone's clock. able work after iphone closed (the screen goes black) app left running (the user did not return home screen).

for example, possible method programmed go off @ 1:30:15 pm no relation current time, , there restrictions depending on whether phone closed or if app running in background?

i found similar post here how generate event on specific time of clock in c#? generates timer based on current time run method later, instead of using clock without relation current time.

i have created poor way of doing this-

{  time_t rawtime; struct tm * timeinfo;  time ( &rawtime ); timeinfo = localtime ( &rawtime ); nslog(@"teststart - test start"); // check if(timeinfo->tm_hour == 12 && timeinfo->tm_min == 01 && timeinfo->tm_sec == 48) {     nslog(@"run method");      printf("the time 12:01:48"); }    else {     nslog(@"else");      [self synctest]; } } 

this run method @ 12:1:48, not acceptable way of doing this. know of better ways , how strain way puts on cpu? thanks

use nstimer , set firedate whichever date want timer fire on , catch notification has fired , perform task.


Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -