ivasic / restframework Goto Github PK
View Code? Open in Web Editor NEWA simple RESTful framework for Cocoa (Mac) & Cocoa Touch (iOS)
A simple RESTful framework for Cocoa (Mac) & Cocoa Touch (iOS)
Did this framework support ios4?
I have a concern, since you are using objC block e.g. completion:^(RFResponse *response)
I think that instead of variable r
should be response
//now execute this request and fetch the response in a block
[RFService execRequest:r completion:^(RFResponse *response) {
NSLog(@"%@", r); //print out full response
NSLog(@"%@", r.dataValue); //dataValue is received response as NSData (e.g. you can do [r.dataValue objectFromJSONData])
}];
and in the second code block example, it should be RFRequestMethodPost
instead of RFRequestMethodGet
Hello,
I see you're deallocing & releasing your objects manually.
Does it means I have to deactivate ARC on my project to use your framework ? Or could i simply modify your sources to make it work with ARC ?
Thanks ;)
Keep it going, your framework really helped me understand the way of dealing with REST services !
Why did you comment out line 348 in file RFRequest.m
/*case RESTRequestBodyTypeJSON:
return @"application/json";*/
How do I post json format?
Hi Ivan!
Thank you for the framework.
How can I add upload a file and additional parameters to the same request?
I've got the following code:
RFRequest *r = [RFRequest requestWithURL:[NSURL URLWithString:BASE_URL] type:RFRequestMethodPost bodyContentType:RFRequestBodyTypeMultiPartFormData resourcePathComponents:token, @"resource", nil];
NSString *jpgPath = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/tempImage.jpg"];
[r addData:[NSData dataWithContentsOfFile:jpgPath] withContentType:@"image/jpeg" forKey:@"image.jpg"];
[r addParam:@"Some String" forKey:@"resource[string_value]"];
[r addParam:@"2012-06-10" forKey:@"resource[another_string_value]"];
Only one parameter is sent to the Rails API.
What am I missing?
Thanks
/ Ola
Can you post some examples how to handle exceptions?
let say you do
[RFService execRequest:r completion:^(RFResponse *response) {
but server is not available or the document is not found (404)
Hi,
I'm trying to upload a file from my iPhone ios 6.
In wireshark, I see that the data is missing, I only see Content-Disposition and Content-Type but no data.
Content-Disposition: form-data; name="file"; filename="mypic.jpeg"\r\n
Content-Type: image/jpeg\r\n\r\n
and after that - NOTHING
Here is my code:
RFRequest* r = [RFRequest requestWithURL:[NSURL URLWithString:url] type:RFRequestMethodPost bodyContentType:RFRequestBodyTypeMultiPartFormData resourcePathComponents:nil];
//add files...
NSData *data = UIImageJPEGRepresentation(self.selectedImage, 1.0);
[r addData:data withContentType:@"image/jpeg" forKey:@"mypic.jpeg"];
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.