2013-01-31 3 views
1

iPhone 앱에 하나 이상의 알림을 설정하려면 어떻게해야합니까? 사용자가 이미지를 (매일, 매주 또는 매월) 가져갈 수 있도록 내 앱의 모든 이미지 프로젝트에 개별 미리 알림을 설정해야합니다. 특정 프로젝트의 카메라, 단일 알림을 설정할 수 있지만 내 앱의 다른 프로젝트에 대해 하나 이상의 알림을 설정하려고하면 모든 프로젝트의 이전 알림을 모두 덮어 씁니다. 나에게 어떤 생각을 주렴.하나의 iPhone 앱에 여러 개의 미리 알림이 있습니다.

+0

UILocalNotification ..... –

+0

수정하고 싶은 코드를 게시해야합니다. –

답변

0

시도해보십시오.

//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]; 


    } 

// 단일 알림 설정을 위해이 메소드를 호출하십시오. // 원하는만큼 설정할 수 있습니다

관련 문제