2013-01-31 4 views
1

Comment pouvons-nous définir plus d'un rappel dans notre application iPhone, je dois définir des rappels individuels pour chaque projet d'image dans mon application afin qu'un utilisateur puisse prendre une image (quotidienne, hebdomadaire ou mensuelle) de la caméra pour un projet spécifique, je suis en mesure de définir un rappel unique, mais quand j'ai essayé de définir plus d'un rappel pour un autre projet dans mon application, il écrase tous les rappels précédents de tous les projets. s'il vous plaît donnez-moi une idée.Plusieurs rappels dans une seule application iPhone

+0

UILocalNotification ..... –

+0

Vous devriez probablement publier du code que vous souhaitez corriger. –

Répondre

0

essayez ceci.

//KeyValue = used for identifying reminder 
    //RepeatType = NSWeekCalendarUnit or NSMonthCalendarUnit 
    //AlertBody = display text 

    -(void)setReminder:(NSDate*)date KeyValue:(NSString*)keyValue RepeatType:(NSInteger)repeatType AlertBody:(NSString*)alertBody 
    { 
     UILocalNotification *localNotif = [[UILocalNotification alloc] init]; 
     if (localNotif == nil) 
      return; 

     localNotif.fireDate = date; 
     localNotif.timeZone = [NSTimeZone defaultTimeZone]; 

     // Notification details 
     localNotif.alertBody = alertBody; 

     // Set the action button 
     localNotif.alertAction = NSLocalizedString(@"View",nil); 

     localNotif.soundName =UILocalNotificationDefaultSoundName; 

     // Specify custom data for the notification 
     NSDictionary *infoDict = [NSDictionary dictionaryWithObject:[NSString stringWithFormat:@"%@",keyValue] forKey:@"ReminderID"]; 

     localNotif.userInfo = infoDict; 
     localNotif.repeatInterval = repeatType; 

     // Schedule the notification 
     [[UIApplication sharedApplication] scheduleLocalNotification:localNotif]; 

     [localNotif release]; 


    } 

// appelle cette méthode pour définir une notification unique. // vous pouvez en définir autant que vous le souhaitez

Questions connexes