iPhone photo app communication with Rails server
I am building an 开发者_JAVA技巧iPhone app which uploads/downloads photos to a Rails server. How should I transfer my photos to/from the Rails server to iPhone? Should I use JSON? My Rails app supports a RESTful architecture. Any pointers to examples would help.
I recently did something similar, and would suggest using ASIHTTP on the iPhone side, communicating with your Rails app.
Here is how to use ASIHTTP: http://allseeing-i.com/ASIHTTPRequest/How-to-use
Pay special attention to the section "Sending a form POST with ASIFormDataRequest"
You can attach photos (or any file, really) simply by saying
[request setFile:@"photo.jpg" forKey:@"photo"]
Then you can access/manipulate it on the Rails side through your params
精彩评论