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 (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to