1

iPhone アプリで複数のリマインダーを設定するにはどうすればよいですか。ユーザーが特定のプロジェクトのカメラから (毎日、毎週、または毎月) 画像を取得できるように、アプリ内のすべての画像プロジェクトに個別のリマインダーを設定する必要があります。単一のリマインダーを設定できますが、アプリで別のプロジェクトに複数のリマインダーを設定しようとすると、すべてのプロジェクトの以前のすべてのリマインダーが上書きされます。アイデアを教えてください。

4

1 に答える 1

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


    }

//単一の通知を設定するためにこのメソッドを呼び出します。// いくつでも設定できます

于 2013-01-31T12:40:37.410 に答える