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

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -