简体   繁体   English

iPhone 照片应用程序与 Rails 服务器的通信

[英]iPhone photo app communication with Rails server

I am building an iPhone app which uploads/downloads photos to a Rails server.我正在构建一个将照片上传/下载到 Rails 服务器的 iPhone 应用程序。 How should I transfer my photos to/from the Rails server to iPhone?我应该如何将我的照片传输到 Rails 服务器或从 Rails 服务器传输到 iPhone? Should I use JSON?我应该使用 JSON 吗? My Rails app supports a RESTful architecture.我的 Rails 应用程序支持 RESTful 架构。 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.我最近做了类似的事情,并建议在 iPhone 端使用 ASIHTTP,与你的 Rails 应用程序通信。

Here is how to use ASIHTTP: http://allseeing-i.com/ASIHTTPRequest/How-to-use以下是如何使用 ASIHTTP: http://allseeing-i.com/ASIHTTPRequest/How-to-use

Pay special attention to the section "Sending a form POST with ASIFormDataRequest"请特别注意“使用 ASIFormDataRequest 发送表单 POST”部分

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然后你可以通过你的参数在 Rails 端访问/操作它

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM