Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Sep 2nd, 2012  |  syntax: None  |  size: 1.00 KB  |  hits: 22  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. // バックグラウンドでGoogle Calendarからイベントを受信して保存するクラス
  2. - (void)main {
  3.     if (!self.isCancelled) {
  4.         NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
  5.         if (!self.isCancelled) {
  6.             NSManagedObjectContext *managedObjectContext = [self managedObjectContext];
  7.             [managedObjectContext setMergePolicy:NSMergeByPropertyObjectTrumpMergePolicy];
  8.             SPEventStore *eventStore = [SPEventStore defaultEventStore];
  9.             events = [[eventStore searchEventsWithPredicate:predicate] retain];
  10.         }
  11.         [pool release];
  12.        
  13.         if (!self.isCancelled) {
  14.             [resultsDelegate performSelectorOnMainThread:@selector(operationSearchEnded:) withObject:self waitUntilDone:NO];
  15.         }
  16.     }
  17. }
  18.  
  19.  
  20. //  メインスレッドのコンテキストを管理しているクラス
  21. - (void)anotherContextDidSave:(NSNotification *)notification {
  22.     [managedObjectContext mergeChangesFromContextDidSaveNotification:notification];
  23. }