mirror of
https://github.com/zhigang1992/RestKit.git
synced 2026-05-12 03:06:30 +08:00
Cleanup trailing whitespace. refs #743
This commit is contained in:
@@ -4,13 +4,13 @@
|
||||
//
|
||||
// Created by Blake Watters on 2/13/11.
|
||||
// Copyright (c) 2009-2012 RestKit. All rights reserved.
|
||||
//
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@@ -46,7 +46,7 @@
|
||||
if (self) {
|
||||
_objectStore = [objectStore retain];
|
||||
}
|
||||
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -55,22 +55,22 @@
|
||||
if (self) {
|
||||
_managedObjectKeyPaths = [[NSMutableSet alloc] init];
|
||||
}
|
||||
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
- (void)dealloc {
|
||||
[_targetObjectID release];
|
||||
_targetObjectID = nil;
|
||||
_deleteObjectOnFailure = NO;
|
||||
[_managedObjectKeyPaths release];
|
||||
[_objectStore release];
|
||||
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void)reset {
|
||||
[super reset];
|
||||
[super reset];
|
||||
[_targetObjectID release];
|
||||
_targetObjectID = nil;
|
||||
}
|
||||
@@ -88,16 +88,16 @@
|
||||
// Overload the target object reader to return a thread-local copy of the target object
|
||||
- (id)targetObject {
|
||||
if ([NSThread isMainThread] == NO && _targetObjectID) {
|
||||
return [self.objectStore objectWithID:_targetObjectID];
|
||||
return [self.objectStore objectWithID:_targetObjectID];
|
||||
}
|
||||
|
||||
|
||||
return _targetObject;
|
||||
}
|
||||
|
||||
- (void)setTargetObject:(NSObject*)targetObject {
|
||||
[_targetObject release];
|
||||
_targetObject = nil;
|
||||
_targetObject = [targetObject retain];
|
||||
_targetObject = nil;
|
||||
_targetObject = [targetObject retain];
|
||||
|
||||
[_targetObjectID release];
|
||||
_targetObjectID = nil;
|
||||
@@ -105,7 +105,7 @@
|
||||
|
||||
- (BOOL)prepareURLRequest {
|
||||
// TODO: Can we just do this if the object hasn't been saved already???
|
||||
|
||||
|
||||
// NOTE: There is an important sequencing issue here. You MUST save the
|
||||
// managed object context before retaining the objectID or you will run
|
||||
// into an error where the object context cannot be saved. We do this
|
||||
@@ -116,7 +116,7 @@
|
||||
[self.objectStore save:nil];
|
||||
_targetObjectID = [[(NSManagedObject*)self.targetObject objectID] retain];
|
||||
}
|
||||
|
||||
|
||||
return [super prepareURLRequest];
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@
|
||||
if (fetchRequest) {
|
||||
return [NSManagedObject objectsWithFetchRequest:fetchRequest];
|
||||
}
|
||||
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@
|
||||
RKLogDebug(@"Skipping cleanup of objects via managed object cache: only used for GET requests.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if ([self.URL isKindOfClass:[RKURL class]]) {
|
||||
NSArray *results = [result asCollection];
|
||||
NSArray *cachedObjects = [self cachedObjects];
|
||||
@@ -146,7 +146,7 @@
|
||||
}
|
||||
} else {
|
||||
RKLogWarning(@"Unable to perform cleanup of server-side object deletions: unable to determine resource path.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE: We are on the background thread here, be mindful of Core Data's threading needs
|
||||
@@ -155,9 +155,9 @@
|
||||
if (_targetObjectID && self.targetObject && self.method == RKRequestMethodDELETE) {
|
||||
NSManagedObject* backgroundThreadObject = [self.objectStore objectWithID:_targetObjectID];
|
||||
RKLogInfo(@"Deleting local object %@ due to DELETE request", backgroundThreadObject);
|
||||
[[self.objectStore managedObjectContextForCurrentThread] deleteObject:backgroundThreadObject];
|
||||
[[self.objectStore managedObjectContextForCurrentThread] deleteObject:backgroundThreadObject];
|
||||
}
|
||||
|
||||
|
||||
// If the response was successful, save the store...
|
||||
if ([self.response isSuccessful]) {
|
||||
[self deleteCachedObjectsMissingFromResult:result];
|
||||
@@ -171,14 +171,14 @@
|
||||
[invocation setSelector:@selector(informDelegateOfError:)];
|
||||
[invocation setArgument:&error atIndex:2];
|
||||
[invocation invokeOnMainThread];
|
||||
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self finalizeLoad:success];
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
NSDictionary* dictionary = [result asDictionary];
|
||||
NSMethodSignature* signature = [self methodSignatureForSelector:@selector(informDelegateOfObjectLoadWithResultDictionary:)];
|
||||
RKManagedObjectThreadSafeInvocation* invocation = [RKManagedObjectThreadSafeInvocation invocationWithMethodSignature:signature];
|
||||
@@ -193,7 +193,7 @@
|
||||
// Overloaded to handle deleting an object orphaned by a failed postObject:
|
||||
- (void)handleResponseError {
|
||||
[super handleResponseError];
|
||||
|
||||
|
||||
if (_targetObjectID) {
|
||||
if (_deleteObjectOnFailure) {
|
||||
RKLogInfo(@"Error response encountered: Deleting existing managed object with ID: %@", _targetObjectID);
|
||||
|
||||
Reference in New Issue
Block a user