I try to set repeating information for alarm.

First I try to set alarm daily with these codes.

CAgnAppt* appt=CAgnAppt::NewL(iParaFormatLayer,iCharFormatLayer);
appt->SetStartAndEndDateTime(startDateTime,endDateTime);

TAgnDailyRpt iAgnDailyRpt;
CAgnRptDef* iAgnRptDef = CAgnRptDef::NewL();

iAgnDailyRpt.SetRepeatForever(ETrue);
iAgnRptDef->SetDaily(iAgnDailyRpt);

appt->SetIsRepeating(ETrue);

appt->SetRptDefL(iAgnRptDef);

appt->SetAlarm(TTimeIntervalDays(0),interval);

iModel->AddEntryL(appt);


When i try to add new alarm it will panic and then show me error
"invalid rpt def 0"

Anyone know why this problem occurs?

Thank you.