|
28 | 28 | #import "PFQueryPrivate.h"
|
29 | 29 | #import "Parse_Private.h"
|
30 | 30 | #import "PFErrorUtilities.h"
|
| 31 | +#import "PFObjectState_Private.h" |
31 | 32 |
|
32 | 33 | @implementation PFInstallation (Private)
|
33 | 34 |
|
@@ -83,6 +84,14 @@ - (NSString *)displayClassName {
|
83 | 84 | return NSStringFromClass([PFInstallation class]);
|
84 | 85 | }
|
85 | 86 |
|
| 87 | +///-------------------------------------- |
| 88 | +#pragma mark - Properties |
| 89 | +///-------------------------------------- |
| 90 | + |
| 91 | +- (void) setObjectId:(NSString *)objectId { |
| 92 | + PFParameterAssertionFailure(@"Installation's objectIds cannot be changed"); |
| 93 | +} |
| 94 | + |
86 | 95 | ///--------------------------------------
|
87 | 96 | #pragma mark - Command Handlers
|
88 | 97 | ///--------------------------------------
|
@@ -223,16 +232,13 @@ - (void)setChannels:(NSArray<NSString *> *)channels {
|
223 | 232 |
|
224 | 233 | - (BFTask *)saveAsync:(BFTask *)toAwait {
|
225 | 234 | return [[super saveAsync:toAwait] continueWithBlock:^id(BFTask *task) {
|
226 |
| - // Do not attempt to resave an object if LDS is enabled, since changing objectId is not allowed. |
227 |
| - if ([Parse _currentManager].offlineStoreLoaded) { |
228 |
| - return task; |
229 |
| - } |
230 |
| - |
231 | 235 | if (task.error.code == kPFErrorObjectNotFound) {
|
232 | 236 | @synchronized (self.lock) {
|
233 | 237 | // Retry the fetch as a save operation because this Installation was deleted on the server.
|
234 | 238 | // We always want [currentInstallation save] to succeed.
|
235 |
| - self.objectId = nil; |
| 239 | + PFObjectState *state = [PFObjectState stateWithState:self._state]; |
| 240 | + state.objectId = nil; |
| 241 | + self._state = state; |
236 | 242 | [self _markAllFieldsDirty];
|
237 | 243 | return [super saveAsync:nil];
|
238 | 244 | }
|
|
0 commit comments