Я использую 3 функции снова и снова, но каждый раз вижу утечки. В чем причина этих утечек?
//function 1
UILocalNotification *localNotification = [[UILocalNotification alloc] init];
localNotification.fireDate = appDelegate.Date_iCal;
localNotification.alertBody = appDelegate.Name;
localNotification.soundName = UILocalNotificationDefaultSoundName;
localNotification.applicationIconBadgeNumber = count;//total number of event in iCal
NSDictionary *infoDict = [NSDictionary dictionaryWithObjectsAndKeys:@"Object 1", @"Key 1", @"Object 2", @"Key 2", nil];
localNotification.userInfo = infoDict;
[[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
[localNotification release] ;
//Local notification add
function2:
EKEventStore *eventStore = [[EKEventStore alloc]init] ;
EKEvent *event = [EKEvent eventWithEventStore:eventStore];
event.title = appDelegate.Name;
event.startDate = appDelegate.Date_iCal;
event.endDate = appDelegate.Date_iCal;
[event setCalendar:[eventStore defaultCalendarForNewEvents]];
NSError *err;
@try
{
[eventStore saveEvent:event span:EKSpanThisEvent error:&err];
NSString* str = [[NSString alloc] initWithFormat:@"%@", event.eventIdentifier];
appDelegate.eventIdentifier = str;
[str release];
}
@catch (NSException * e)
{
//NSLog(@"exeption run1");
}
[eventStore release];
//function3
int flag1 = 0;
if( [appDelegate.display_date length] == 0 || [appDelegate.timestamp1 length] == 0)
{
NSDateFormatter *df = [[NSDateFormatter alloc] init];
[df setDateFormat:@"dd.MM.yyyy hh:mm a"];
appDelegate.display_date = [df stringFromDate:[NSDate date]];
appDelegate.timestamp1 = @"empty";
[df release];
}
addStmt1 = nil;
if(addStmt1 == nil)
{
const char *sql ="insert into actions(action_title,action_date,dificulty_level,subid,flag,needle_num,display_date,event) Values(?,?,?,?,?,?,?,?)";
if(sqlite3_prepare_v2(database1, sql, -1, &addStmt1, NULL) != SQLITE_OK)
NSAssert1(0, @"Error while creating add statement. '%s'", sqlite3_errmsg(database1));
}
sqlite3_bind_text(addStmt1, 1, [appDelegate.Name UTF8String], -1, SQLITE_TRANSIENT);
sqlite3_bind_text(addStmt1, 2, [appDelegate.timestamp1 UTF8String], -1, SQLITE_TRANSIENT);
sqlite3_bind_double(addStmt1, 3, appDelegate.dif_lev);
sqlite3_bind_int(addStmt1,4,(int)appDelegate.Id);
sqlite3_bind_int(addStmt1,5,flag1);
sqlite3_bind_int(addStmt1,6,(int)appDelegate.needle_num);
sqlite3_bind_text(addStmt1, 7, [appDelegate.display_date UTF8String], -1, SQLITE_TRANSIENT);
sqlite3_bind_text(addStmt1, 8, [appDelegate.eventIdentifier UTF8String], -1, SQLITE_TRANSIENT);
if(SQLITE_DONE != sqlite3_step(addStmt1))
{
@try
{
NSAssert1(0, @"Error while inserting data. '%s'", sqlite3_errmsg(database1));
}
@catch (NSException * e)
{
//NSLog(@"exeption run3");
}
}
sqlite3_reset(addStmt1);
sqlite3_finalize(addStmt1);
if( [appDelegate.display_date isEqualToString:@"empty"])
appDelegate.display_date = @"";
Где я иду не так?
Эти функции запускаются в 1 клик.