用iPhone API拍照并将其传输到服务器 [英] Take picture with iPhone API and transfer it to a server

查看:171
本文介绍了用iPhone API拍照并将其传输到服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了一个可可应用程序在iPhone上拍照。我需要将拍摄的图像转移到除iPhone以外的某个地方,即另一个服务器。

I have written an cocoa application to take a picture on the iPhone. I need to transfer the images taken to somewhere besides the iPhone namely another server. Does anyone know how I can accomplish this?

谢谢,
Joe

Thanks, Joe

推荐答案

首先得到一个服务器,找出你想使用什么样的手机< --->服务器API。有很多方法可以工作。一个简单而常见的方案是一个REST API,通过HTTP POST上传照片。

First get a server and figure out what kind of phone <---> server API you want to use. There are any number of ways it can work. A simple and common scheme is a REST API with photos being uploaded via HTTP POST.

基本方案如下:


  1. 拍摄照片

  2. 转换为JPG(有此功能)

  3. NSURL *类

  4. 将JPG数据设置为POST正文(或mutipart表单帖子的一部分)

  1. Take picture
  2. Convert to JPG (there's a function for this)
  3. Construct HTTP POST using the NSURL* classes
  4. Set JPG data as POST body (or one part of a mutipart form post)

不需要转换为base64。

Converting to base64 should not be necessary.

如果您从未将任何类型的服务器API放在一起,则有任何数量的示例可用。大多数照片共享网站都有公共API,可能是有用的参考。

If you've never put together any kind of server API, there are any number of examples available. Most photo-sharing sites have public APIs which may be useful references.

这篇关于用iPhone API拍照并将其传输到服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆