2011-01-09 8 views
1

을 최적화하기 위해 어떻게 엔티티 에 그리고이 코드 불구하고 페치 요청을 사용하여 여러 localNofications를 보내려고하고있어)UILocalNotification 과정

NSFetchRequest *myRequest = [[NSFetchRequest alloc] init]; 
    NSPredicate *predicate = [NSPredicate predicateWithFormat:@"active == YES"]; 
    [myRequest setEntity:[NSEntityDescription entityForName:@"Entry" inManagedObjectContext:managedObjectContext]]; 
    [myRequest setPredicate:predicate]; 
    NSError *error = nil; 
    NSArray *fetchedObjects = [self.managedObjectContext executeFetchRequest: myRequest error: &error]; 
    if (fetchedObjects == nil){ 
// Deal with error... 
} 

// We fill the NSMutableArray with the values of the fetch 
self.activeList = [[NSMutableArray alloc] initWithArray:[fetchedObjects valueForKey:@"textbody"]]; 
[self scheduleAlarms:[self.activeList objectAtIndex:0]]; 
[fetchedObjects release]; //this line crashes the app 

일 잘 작동합니다. 나는 그것을 놓아 주기로되어 있지 않습니까?

2) localNotif.userinfo를 사용하여 각 localNotification을 내 activeList의 문자열로 예약하는 메서드를 호출하는 대신 코드를 최적화 할 수 있습니까? 나는 그것을하는 방법을 알아낼 수 없다.

오토 릴리즈있는 NSArray를 반환 executeFetchRequest

답변

0

1), 수동으로 해제 할 필요가 없습니다

감사합니다,

마이크

2) 회원님이 ...

을 최적화 원하는 작업 취소
+0

감사합니다. 최적화를 통해 로컬 알림을 한 번에 하나씩 예약하지 않는 방법을 의미했습니다. 로컬 알림을 설정하기 위해 userinfo 사전을 사용할 수도 있지만 로컬 알림 참조 가이드는이를 구현하는 방법이 다소 모호합니다. –