objective c - NSTimer, NSRunloop and deep sleeping mac -
i'm programming app in objective-c on mac , need help. each day, @ 23:59, app calling method generate report
nstimer *timer = [[nstimer alloc] initwithfiredate:endoftheday interval:0.0 target:self selector:@selector(endday) userinfo:nil repeats:no]; [[nsrunloop currentrunloop] addtimer:timer formode: nsdefaultrunloopmode];
which working expected unless computer in deep sleep mode. thing : need timer call method @ exact moment of day if in sleep mode. i'd not have prevent sleep. can me?
thanks in advance!
check out iopmschedulepowerevent:
ioreturn iopmschedulepowerevent( cfdateref time_to_wake, cfstringref my_id, cfstringref type);
note must called root.
Comments
Post a Comment