nsdate - Alarm Clock for iOS -


i tried re-write following tutorial under xcode 4.6.3 - http://vimeo.com/29824336

but have problem @ around 24:00 code not bringing alarm:

-(void) schedulelocalnotificationwithdate:(nsdate *)firedate {     uilocalnotification *notification = [[uilocalnotification alloc] init];      notification.firedate = firedate;     notification.alertbody = @"time wake up!";     notification.soundname = @"snsd-oh.caf";     nslog(@"ring ring ring!");      [[uiapplication sharedapplication] schedulelocalnotification: notification]; }  - (ibaction) alarmsetbuttontapped:(id)sender {         nsdateformatter *dateformatter = [[nsdateformatter alloc] init];     dateformatter.timezone = [nstimezone defaulttimezone];     dateformatter.timestyle = nsdateformattershortstyle;     dateformatter.datestyle = nsdateformattershortstyle;      nsstring *datetimestring = [dateformatter stringfromdate: datetimepicker.date];     nslog(@"alarm set button tapped: %@", datetimestring);      [self schedulelocalnotificationwithdate: datetimepicker.date]; } 

what did wrong?

your app must not running in foreground when notification fires.

if want play sound in foreground,you can use combination of uialertview , 'avaudioplayer'.

you can setup code in

-(void)application:(uiapplication *)application didreceivelocalnotification:(uilocalnotification *)notification delegate method of appdelegate.m.

feel free ask further.


Comments

Popular posts from this blog

codeigniter - Fatal error: Call to undefined function lang() in CI Merchant using CardSave -

javascript - CasperJS/PhantomJS failing SSL handshakes on some sites even with --ssl-protocol=any -

python - Received unregistered task using Celery with Django -