|
15 | 15 | #import "PFAssert.h" |
16 | 16 | #import "PFDecoder.h" |
17 | 17 | #import "PFEncoder.h" |
| 18 | +#import "PFLogging.h" |
18 | 19 | #import "PFErrorUtilities.h" |
19 | 20 | #import "PFFileManager.h" |
20 | 21 | #import "PFJSONSerialization.h" |
@@ -1028,15 +1029,23 @@ - (void)updateObjectIdForObject:(PFObject *)object |
1028 | 1029 | @synchronized(self.lock) { |
1029 | 1030 | // See if there's already an entry for new objectId. |
1030 | 1031 | PFObject *existing = [self.classNameAndObjectIdToObjectMap objectForKey:key]; |
1031 | | - PFConsistencyAssert(existing == nil || existing == object, |
1032 | | - @"Attempted to change an objectId to one that's already known to the OfflineStore. className: %@ old: %@, new: %@", |
1033 | | - className, oldObjectId, newObjectId); |
1034 | | - |
| 1032 | + if (existing != nil && existing != object) { |
| 1033 | + PFLogError(PFLoggingTagCommon, |
| 1034 | + @"Attempted to change an objectId to one that's already known to the OfflineStore. className: %@ old: %@, new: %@", |
| 1035 | + className, oldObjectId, newObjectId); |
| 1036 | + PFLogError(PFLoggingTagCommon, |
| 1037 | + @"Set a breakpoint on PFOfflineStoreReplaceExisingObject() to debug the issue"); |
| 1038 | + PFLogError(PFLoggingTagCommon, |
| 1039 | + @"Starting 1.17.0, the new object will replace the old one, if this is causing unexpected behaviours, please open an issue https://github.com/parse-community/Parse-SDK-iOS-OSX/issues/new"); |
| 1040 | + PFOfflineStoreReplaceExisingObject(); |
| 1041 | + } |
1035 | 1042 | // Okay, all clear to add the new reference. |
1036 | 1043 | [self.classNameAndObjectIdToObjectMap setObject:object forKey:key]; |
1037 | 1044 | } |
1038 | 1045 | } |
1039 | 1046 |
|
| 1047 | +void PFOfflineStoreReplaceExisingObject() {} |
| 1048 | + |
1040 | 1049 | - (NSString *)_generateKeyForClassName:(NSString *)className |
1041 | 1050 | objectId:(NSString *)objectId { |
1042 | 1051 | return [NSString stringWithFormat:@"%@:%@", className, objectId]; |
|
0 commit comments