Skip to content

Commit 66d1f8b

Browse files
committed
Fix issue #916
- As per discussion over there, @nlutsenko and @richardjrossiii were A1 on the resolution Thanks @czgarrett for the fix Closes #931
1 parent cab5ac9 commit 66d1f8b

File tree

1 file changed

+22
-19
lines changed

1 file changed

+22
-19
lines changed

Parse/Parse/PFObject.m

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -383,29 +383,32 @@ + (BOOL)canBeSerializedAsValue:(id)value
383383
// @param saved A set of objects that we can assume will have been saved.
384384
// @param error The reason why it can't be serialized.
385385
- (BOOL)canBeSerializedAfterSaving:(NSMutableArray *)saved withCurrentUser:(PFUser *)user error:(NSError **)error {
386+
NSDictionary *dictionaryRepresentationCopy;
386387
@synchronized (lock) {
387-
// This method is only used for batching sets of objects for saveAll
388-
// and when saving children automatically. Since it's only used to
389-
// determine whether or not save should be called on them, it only
390-
// needs to examine their current values, so we use estimatedData.
391-
if (![[self class] canBeSerializedAsValue:_estimatedData.dictionaryRepresentation
392-
afterSaving:saved
393-
error:error]) {
394-
return NO;
395-
}
388+
dictionaryRepresentationCopy = [_estimatedData.dictionaryRepresentation copy];
389+
}
396390

397-
if ([self isDataAvailableForKey:@"ACL"] &&
398-
[[self ACLWithoutCopying] hasUnresolvedUser] &&
399-
![saved containsObject:user]) {
400-
if (error) {
401-
*error = [PFErrorUtilities errorWithCode:kPFErrorInvalidACL
402-
message:@"User associated with ACL must be signed up."];
403-
}
404-
return NO;
405-
}
391+
// This method is only used for batching sets of objects for saveAll
392+
// and when saving children automatically. Since it's only used to
393+
// determine whether or not save should be called on them, it only
394+
// needs to examine their current values, so we use estimatedData.
395+
if (![[self class] canBeSerializedAsValue:dictionaryRepresentationCopy
396+
afterSaving:saved
397+
error:error]) {
398+
return NO;
399+
}
406400

407-
return YES;
401+
if ([self isDataAvailableForKey:@"ACL"] &&
402+
[[self ACLWithoutCopying] hasUnresolvedUser] &&
403+
![saved containsObject:user]) {
404+
if (error) {
405+
*error = [PFErrorUtilities errorWithCode:kPFErrorInvalidACL
406+
message:@"User associated with ACL must be signed up."];
407+
}
408+
return NO;
408409
}
410+
411+
return YES;
409412
}
410413

411414
// This saves all of the objects and files reachable from the given object.

0 commit comments

Comments
 (0)