Skip to content

Commit e2fbecc

Browse files
Merge pull request #239 from ParsePlatform/richardross.offlinestore.children.fix
Fixed an issue where LDS wouldn't search the whole subtree for objects not yet fetched.
2 parents 5d51fba + d4e2f5b commit e2fbecc

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Parse/Internal/PFEventuallyPin.m

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,14 @@ + (BFTask *)_pinEventually:(PFObject *)object
158158
pin[PFEventuallyPinKeyCommand] = commandDictionary;
159159
}
160160

161-
return [[pin pinInBackgroundWithName:PFEventuallyPinPinName] continueWithBlock:^id(BFTask *task) {
161+
// NOTE: This is needed otherwise ARC releases the pins before we have a chance to persist the new ones to disk,
162+
// Which means we'd lose any columns on objects in eventually pins not currently in memory.
163+
__block NSArray *existingPins = nil;
164+
return [[[self findAllEventuallyPin] continueWithSuccessBlock:^id(BFTask *task) {
165+
existingPins = task.result;
166+
return [pin pinInBackgroundWithName:PFEventuallyPinPinName];
167+
}] continueWithSuccessBlock:^id(BFTask *task) {
168+
existingPins = nil;
162169
return pin;
163170
}];
164171
}

0 commit comments

Comments
 (0)