2011-07-14 10 views

答えて

3

fireDate 8.00にPMを設定し、NSDayCalendarUnitからrepeatIntervalを設定し、正しい[[UIApplication sharedApplication] scheduleLocalNotification: myNotification];

+0

電話がサイレントモードに設定されていても音を出すように強制することはできますか? – Anthony

+0

アプリがバックグラウンドで実行されていない場合でも、これは機能しますか? – Satyam

+0

はい、そうです。魔法です。 – dasdom

2

dasdomの答えとアラートをスケジュールします。デバイスにサイレントモードが設定されている場合は、アラームで音が鳴らないようにするだけです。 UILocalNotificationのAppleの制限です。

+0

それはすべきです!私は電話が黙って欲しいと思っているときには、どんなアプリもノーズにしたくない! – dasdom

0
UILocalNotification *localNotification =[[UILocalNotification alloc]init]; 

NSCalendar *calendar=[NSCalendar currentCalendar]; 
    [calendar setTimeZone:[NSTimeZone defaultTimeZone]]; 

    unsigned currentFlag=NSDayCalendarUnit|NSMonthCalendarUnit|NSYearCalendarUnit|NSWeekdayCalendarUnit; 

    NSDateComponents *comp=[calendar components:currentFlag fromDate:[NSDate date]]; 

    comp.hour=8; 
    comp.minute=0; 
    comp.second=0; 

    NSDate *date=[[calendar dateFromComponents:comp]dateByAddingTimeInterval:0]; 

    if (localNotification==nil) { 
     return; 
    } 

    localNotification.fireDate=date; 
    localNotification.timeZone=[NSTimeZone defaultTimeZone]; 
    localNotification.repeatCalendar=[NSCalendar currentCalendar]; 

    [email protected]"Good Morning dude..!"; 

    [email protected]"Snooze"; 

    localNotification.repeatInterval=NSDayCalendarUnit; 

    [email protected]"goodmorning.caf"; 

[[UIApplication sharedApplication]scheduleLocalNotification:localNotification]; 

私は、これはあなたを助けることを願っています...!

関連する問題