使用 Amazon S3 SDK 备份和恢复 iPhone 数据
我有一个 Amazon S3 账户并已下载 AWSiOSSDK 框架/SDK 包。该示例运行良好。我可以“列出存储桶”并上传示例数据。
我想使用 S3 备份用户数据,然后提供下载相同备份以在需要时恢复数据的机会。
我认为确定执行此操作的方法/类很容易,但我正在努力。我已经浏览了文档,但它是压倒性的(对于这样的“直接”要求)。我也找不到任何在线教程。我尝试删除相关代码&亚马逊示例中的框架,但在尝试了几个小时后停止了。
有谁向我指出一个教程(或提供示例代码),展示如何在 XCode 中使用 Amazon SDK?这是我第一次在 iPhone 上尝试在线备份,所以如果这看起来很简单,请原谅。
感谢您的帮助。
I have an Amazon S3 account and have downloaded the AWSiOSSDK framework/SDK pack. The example works fine. I can "List Buckets" and upload sample data.
I want to use S3 to backup user data and then provide the opportunity to download the same backup to restore the data as and when needed.
I thought it would be easy to identify the methods/classes to do this, but I am struggling. I have looked through the documentation but it is overwhelming (for such a "straight forward" requirement). I cannot find any online tutorials either. I tried stripping out the relevant code & frameworks from Amazon's example, but stopped after hours of trying to get anything to work.
Does anyone point me to a tutorial (or provide sample code) showing how to use the Amazon SDK in XCode? This is the first time I have tried online backup on iPhone, so please excuse if this seems simplistic.
Appreciate your help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
下载:
response.body 是一个带有下载的 NSData
。要上传,S3PutObjectRequest 的工作方式大致相同。您可以指定文件名或 NSData。
To download:
response.body is an NSData with the the download
To upload, S3PutObjectRequest works much the same way. You can specify either a filename or NSData.
谢谢大卫。真的很感激。不过有几个问题。我复制了 AWSiOSSDK.framework,但我想我必须将其导入标头中?当我添加 #import AWSiOSSDK/S3/AmazonS3Client.h 时,它似乎阻止了任何 NSLog 消息。很奇怪。不用说我的上传不起作用,但我似乎无法调试。这是代码:
header
main
Thanks David. Really appreciated. A couple of issues though. I copied in AWSiOSSDK.framework, but I presume I have to import it into the header? When I add #import AWSiOSSDK/S3/AmazonS3Client.h it seems to prevent any NSLog messages. Very odd. Needless to say my upload is not working, but I cannot seem to debug. Here is the code:
header
main