0

I have an application that is written in Monotouch and one function that it offers is taking photos that are then synchronized back to a Sybase Sql Anywhere database on our server. This mechanism is working fine on the Windows version of our application, but on iOS we have hit technical issues pertaining to saving the photos in the Sybase Ultralite database on the iPad or iPhone. Very briefly, the photos are saving correctly if we set the resolution to VERY low on an iPhone, but failing if the resolution is higher. The issue is related to the size of the image data that is being saved. On an iPad, the photos are generally larger than those taken with an iPhone, so saving to the database is failing more often on iPad than iPhone.

Anyway, that is just some background to our situation and the actual Ultralite issue is not the focus of this question. What I am looking for here is alternative solutions (Objective-C or Monotouch) for providing this functionality. I immediately think about saving to a local database and then replicating the photo data back to the server because I have a lot of experience with database replication. But maybe there is a better way of solving this?

The solution must allow the application to:

  • Save a photo so that it is available locally (even after shutdown of the application or restart of the device)
  • Must allow photos to taken and saved offline, because an internet connection is not always available.
  • Either synchronize the image data back to the server database or synchronize a URL back that the application in the back-office can retrieve the photo. Obviously, at the point of synchronization the application must be online.

Can anyone suggest solutions or API's that might allow me to provide this functionality without having to synchronize the image data? I am thinking along the lines of maybe saving the image to the cloud and then synchronizing only a URL that can be used in the back-office to retrieve the photo. Any suggestions?

4

1 回答 1

1

根据您所写的内容,我可能会建议您不要在 iOS 设备上正确保留图像。它们上的内存非常有限,将批量 HR 图像保存在 RAM 中会导致内存警告和应用程序崩溃。您应该考虑使用CoreData来存储指向正在保存到磁盘的图像的本地链接。我想,您熟悉UIImagePickerController委托回调,它允许您检索 UIImage 并将其保存到应用程序的 Documents 目录中,因此我将其省略。我不确定“必须允许离线拍摄和保存照片”是什么意思,因为既不UIImagePickerController也不AVFoundation依赖于互联网连接。因此,为了离线保存图像,只需使用其中一种(UIImagePickerController更可取的是,如果您不需要在相机屏幕上显示任何自定义 UI,并且更容易开始使用)。如果您需要同时同步多个图像,您应该显示一个 UIProgressBar 并在队列中上传图像,而您发出的每个 REST 请求都是用于一次上传单个图像的多部分数据请求。这样你就不会在内存管理上有任何问题,你也可以使用 HR 质量来拍摄图像,不需要使用最低的。对于 HTTP 连接,您可能需要考虑使用ASIHTTPRequest,因为它很简单,使用起来非常简单,并且可能会为您节省一些处理多部分请求的时间。

于 2012-07-31T08:52:26.857 回答