Comments (9)
I've fixed this on my local copy by editing the method objectLoaderForObject method to check the request type and only include the paramaters if it is not a DELETE request:
if (method != RKRequestMethodDELETE) {
loader.params = params;
}
I believe that the object is supposed to be deleted from the core data store as well, but it appears this isn't happening.
Seems to be an error with this method
- (void)processLoadModelsInBackground:(RKResponse *)response
Seems flawed in how it works, it doesn't seem to reach the bit where it deletes the object as the logic checks for self.targetObject which is set by the objectLoaderForObject method.
Seems like it should be checking for self.method at some stage and then running deleteObject on the targetObject?
from restkit.
David -
I have not seen an instance where one would want to include parameters in the DELETE request, but its certainly possible. The right place to fix this for Rails is probably in the RKRailsRouter, where we can tie off the payload specifically for Rails idiomatic requests.
It does look like we should add support for deleting the object under the check for
if (self.targetObject) {
...
code path. The support at the bottom is for removing objects that don't appear in a loaded collection (i.e. I load an authoritative collection of objects and something in the cache is gone, it should be deleted). A check for method == DELETE and a successful response should trigger a delete of the persistent object.
from restkit.
Ok, I used the dynamic router as it did what I needed so haven't looked at the RKRailsRouter. I hacked on delete with something like this
if(_targetObjectID && self.method == RKRequestMethodDELETE) {
NSManagedObject* backgroundThreadModel = [self.managedObjectStore objectWithID:_targetObjectID];
[[objectStore managedObjectContext] deleteObject:backgroundThreadModel];
}
Which worked but was mainly to test it out. I've had to swap to my own httpriot based model manager because I couldn't get certain things to work, but am keen to see RestKit progress so might contribute when I can as my own rolled one doesn't use coredata.
from restkit.
David -
We are adding support for the use-cases you outlined. What other issues have you been running into preventing adoption of RestKit? We are happy to fix/enhance the framework or offer support if it helps you use (and later contribute to :-) the library.
- Blake
from restkit.
Posting with data was just flat out not working, my Rails dev server wasn't even acknowledging that it had been hit. It was pretty late at night so I sort of gave up without much debugging. I can swap to RestKit relatively easy so when I realise that adding my own local caching will be to much extra work I will probably swap back.
from restkit.
We have just pushed a fix that adds deletion of individual objects when a DELETE request is successful. We've also updated the Rails router so that it returns a nil serialization for DELETE requests against objects.
Swap it back when you have a change and we can see if things are working better.
Blake
from restkit.
I will swap it over and try it out.
from restkit.
Any update here?
from restkit.
Sorry, it appears to be fine now. Thanks
from restkit.
Related Issues (20)
- Not getting response using Restkit 0.27.2 HOT 2
- iOS 12 crash HOT 1
- iOS 12 RKManagedObjectRequestOperation Hangs HOT 1
- App crashes when calling "refreshAllObjects" in iOS 8 HOT 1
- DeadLock iOS 12 HOT 2
- Does not support NSdate to json HOT 1
- Thanks for your patience. And is it possible to update AFNetworking to 3.x? HOT 2
- What's the max capacity of response?
- Context save responses with invalid boolean value
- Cannot use RestKit 0.27.x for Siri Shortcut intents
- Replace NSURLConnection with NSURLSession. HOT 1
- How to Tell the Version of RestKit Included in Project HOT 1
- RestKit is missing to save one record in core-data
- Mapping boolean response
- [RKObjectMapping .cxx_destruct]
- App Crash , Xcode 12.5 this class is not key value coding-compliant for the key HOT 2
- Xcode 12.5 / Xcode 13 Issues
- CoreData: this class is not key value coding-compliant for the key @count. at
- Need support for iOS 17 & Xcode 15 and above with the new URL string parsing changes HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from restkit.