RestKit is so poorly documented that I'm finding it's a massive pain to figure out how to make it work.
I didn't know jack about how to make a server, but using the documentation for Django Rest Framework, I was able to find out how to make a RESTful API for my server in a matter of a few hours:
http://www.django-rest-framework.org/#tutorial
I thought that would be the hard part, being the part I knew nothing about beforehand. Next up is making the client app for iOS. That's supposed to be the easy part, because I've been making iOS apps for years. I haven't had to dead with REST much, but I've heard plenty of people mention RestKit before, so I decided to add that to my project.
What next?
No, really, this is their idea of documentation:
http://restkit.org/api/0.10.0/index.html
Thanks, I could have read the header files myself.
They have absolutely nothing telling you where to begin. It's just an alphabetized list of all the included classes. If this were a simple framework with 3 classes, that might cut it. It's not. It's a list of 100 classes, protocols, and categories all lumped together without any diagrams or organization to show you how to begin. No overview telling you how to make a minimal project using it. Not a single freaking thing.
Google searches turn up a single useful result for how to use RestKit. RayWenderlich has a tutorial which purports to demonstrate RestKit, but it seems to me that the vast majority of what it contains is how to set up a basic Master - Detail iOS app.
http://www.raywenderlich.com/58682/introduction-restkit-tutorial
It covers how to make a GET request. And that's all.
Flying blind from that I managed to get DELETE requests working.
But I can't for the life of me get it to POST or PUT anything.
Here's an example of what I've tried:
message is a simple data class with a title and a body property, each NSStrings. Running these methods, I get an error response with the suggestion:
I've checked - the body and title property each contain text. I've been trying to read the crap that RestKit outputs, but it seems to me that it's not transmitting any actual content from the message I'm giving it.
I didn't know jack about how to make a server, but using the documentation for Django Rest Framework, I was able to find out how to make a RESTful API for my server in a matter of a few hours:
http://www.django-rest-framework.org/#tutorial
I thought that would be the hard part, being the part I knew nothing about beforehand. Next up is making the client app for iOS. That's supposed to be the easy part, because I've been making iOS apps for years. I haven't had to dead with REST much, but I've heard plenty of people mention RestKit before, so I decided to add that to my project.
What next?
No, really, this is their idea of documentation:
http://restkit.org/api/0.10.0/index.html
Thanks, I could have read the header files myself.
They have absolutely nothing telling you where to begin. It's just an alphabetized list of all the included classes. If this were a simple framework with 3 classes, that might cut it. It's not. It's a list of 100 classes, protocols, and categories all lumped together without any diagrams or organization to show you how to begin. No overview telling you how to make a minimal project using it. Not a single freaking thing.
Google searches turn up a single useful result for how to use RestKit. RayWenderlich has a tutorial which purports to demonstrate RestKit, but it seems to me that the vast majority of what it contains is how to set up a basic Master - Detail iOS app.
http://www.raywenderlich.com/58682/introduction-restkit-tutorial
It covers how to make a GET request. And that's all.
Flying blind from that I managed to get DELETE requests working.
But I can't for the life of me get it to POST or PUT anything.
Here's an example of what I've tried:
Code:
[manager postObject:message
path:@"/rantt/rantt/.json"
parameters:nil
success:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult) {
[mappingResult.array enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
[self insertNewObject:(RanttMessage *)obj];
}];
} failure:nil];
message is a simple data class with a title and a body property, each NSStrings. Running these methods, I get an error response with the suggestion:
Code:
NSLocalizedRecoverySuggestion={"body": ["This field is required."]
I've checked - the body and title property each contain text. I've been trying to read the crap that RestKit outputs, but it seems to me that it's not transmitting any actual content from the message I'm giving it.