• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Recursive call-back block
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Recursive call-back block


  • Subject: Recursive call-back block
  • From: Mikkel Islay <email@hidden>
  • Date: Tue, 10 Apr 2012 16:13:28 +0200

Hello,

The (prototype) code below updates a number of objects of a NSManagedObject-sublass (Progenitor) from a remote host. As the number of objects to update is unknown I would like to use a call-back passed to the updater class invoked by startParserWithObjectId: completionBlock: to recursively call returnblock on the next progenitor-object, so serially, when the update-task has completed.

However, the static analyser gives me the warning : "Variable 'returnblock' is uninitialized when captured by block". It is unclear to me how to interpret the message. Can anyone shed light on it?

    NSEnumerator __block *collectionEnum = [progenitors objectEnumerator];
    Progenitor *firstProgenitor = [collectionEnum nextObject];

    void (^returnblock)(Progenitor *) = ^(Progenitor *aProgenitor) {
        if (aProgenitor == nil)  return;
       	CellUpdater *aCellUpdater = [[CellUpdater alloc] init];
        [aCellUpdater setThisPersistentStoreCoordinator:thisPersistentStoreCoordinator];

        [aCellUpdater startParserWithObjectId:[aProgenitor objectID] completionBlock:^(NSManagedObjectID *anID) {
           	[[NSNotificationCenter defaultCenter] postNotificationName:@"updateExistsForProgenitor" object:anID];
            returnblock([collectionEnum nextObject]);
         }];
    };

   returnblock(firstProgenitor);

Thanks,
Mikkel
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Recursive call-back block
      • From: Fritz Anderson <email@hidden>
  • Prev by Date: Why get my constraints broken?
  • Next by Date: Re: How to bind to NSMutableArray that may contain zero objects?
  • Previous by thread: Why get my constraints broken?
  • Next by thread: Re: Recursive call-back block
  • Index(es):
    • Date
    • Thread