
Untitled
By: a guest on
Sep 2nd, 2012 | syntax:
None | size: 1.00 KB | hits: 22 | expires: Never
// バックグラウンドでGoogle Calendarからイベントを受信して保存するクラス
- (void)main {
if (!self.isCancelled) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
if (!self.isCancelled) {
NSManagedObjectContext *managedObjectContext = [self managedObjectContext];
[managedObjectContext setMergePolicy:NSMergeByPropertyObjectTrumpMergePolicy];
SPEventStore *eventStore = [SPEventStore defaultEventStore];
events = [[eventStore searchEventsWithPredicate:predicate] retain];
}
[pool release];
if (!self.isCancelled) {
[resultsDelegate performSelectorOnMainThread:@selector(operationSearchEnded:) withObject:self waitUntilDone:NO];
}
}
}
// メインスレッドのコンテキストを管理しているクラス
- (void)anotherContextDidSave:(NSNotification *)notification {
[managedObjectContext mergeChangesFromContextDidSaveNotification:notification];
}