xcode 如何使用 ios 的 blob 存储服务?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16070533/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 03:14:38  来源:igfitidea点击:

How to use the blob storage service from ios?

iphoneiosobjective-cxcodeazure-storage

提问by Ajay

In my application I need to use the Windows Azure services to store the data for that I am using this:http://www.windowsazure.com/en-us/develop/mobile/tutorials/get-started-with-data-ios/sdk for Windows azure integration from my app. Now I need to upload the images to Azure and for that I was using the same sdk...But later I found that the right place in Windows Azure to upload the larger images is to Blob Storage Client.

在我的应用程序中,我需要使用 Windows Azure 服务来存储我正在使用的数据:http: //www.windowsazure.com/en-us/develop/mobile/tutorials/get-started-with-data- ios/sdk for Windows azure 集成从我的应用程序。现在我需要将图像上传到 Azure,为此我使用了相同的 sdk...但后来我发现在 Windows Azure 中上传较大图像的正确位置是 Blob 存储客户端。

In .Net they have the different library and I found this link http://www.windowsazure.com/en-us/develop/net/how-to-guides/blob-storage/for uploading the images to blob storage.

在 .Net 中,他们有不同的库,我找到了这个链接http://www.windowsazure.com/en-us/develop/net/how-to-guides/blob-storage/用于将图像上传到 blob 存储。

But how can I do that with Objective C?

但是我怎么能用Objective C做到这一点呢?

After some research I found this link http://www.deviantpoint.com/post/2012/02/18/Using-Azure-Storage-Services-from-an-iPhone-App-Part-1-Table-and-Blob-setup-Azure-iOS-toolkit-and-Model-Classes.aspxbut its not clear about How to upload an image and getting the image url in response?

经过一番研究,我找到了这个链接http://www.deviantpoint.com/post/2012/02/18/Using-Azure-Storage-Services-from-an-iPhone-App-Part-1-Table-and-Blob -setup-Azure-iOS-toolkit-and-Model-Classes.aspx但不清楚如何上传图像并获取图像 url 作为响应?

回答by Ajay

After a lots of R&D...I finally found the solution..

经过大量的研发......我终于找到了解决方案......

Here is my sample project Blob Examplewritten in Objective C

这是我用 Objective C 编写的示例项目Blob Example

& also tried with Swift & is working as expected. Here is my Swift Example Project.

& 也尝试过 Swift & 正在按预期工作。这是我的Swift 示例项目

Just replace your account credentials with respective ones and you are good to go..!!

只需用相应的帐户凭据替换您的帐户凭据,您就可以开始了..!!

Note: Try to use UIImageJPEGRepresentationinstead of UIImagePNGRepresentationbecause png takes more size than jpg.

注意:尝试使用UIImageJPEGRepresentation而不是UIImagePNGRepresentation因为 png 比 jpg 占用更大的尺寸。

回答by jaggo

REST API maybe better for iOS devices. Azure SDK does not have object-c support as good as C# I am afraid.

REST API 可能更适合 iOS 设备。恐怕 Azure SDK 没有像 C# 那样好的 object-c 支持。

http://msdn.microsoft.com/en-us/library/windowsazure/dd135733.aspx

http://msdn.microsoft.com/en-us/library/windowsazure/dd135733.aspx

回答by Chris Prince

See the following https://github.com/crspybits/Blobbishfor an Azure Objective-C example in a non-SAS style.

有关非 SAS 样式的 Azure Objective-C 示例,请参阅以下https://github.com/crspybits/Blabbish