简体   繁体   English

向HTTPS域发送的alamofire请求与对HTTP请求的请求是否有所不同?

[英]Is an alamofire request to a HTTPS domain any different from that to HTTP?

I just added SSL to my backend framework (Django REST API) and I want my iOS application to talk to it. 我刚刚将SSL添加到我的后端框架(Django REST API)中,并且希望我的iOS应用程序与之对话。 Do I have to do anything differently on the iOS side of my project? 我在项目的iOS端是否必须做其他不同的事情? How do I tell Alamofire to encrypt the data its sending? 如何告诉Alamofire对发送的数据进行加密? Or Does it happen automatically? 还是会自动发生?

The only difference is using https instead of http. 唯一的区别是使用https而不是http。 I have the same setup at work, and originally thought I was going to have to delve into certificates. 我在工作时使用相同的设置,最初以为我必须深入研究证书。 I started heading in that direction and then realized all my requests worked as soon as I stuck the "s" on the end. 我开始朝那个方向前进,然后意识到我所有的请求都在我最后加上“ s”后就起作用了。

I will say, while using NSStream, you do have to setup the stream to handle the certificate. 我要说的是,在使用NSStream时,您必须设置流以处理证书。 I am doing this in another application, but that is below the URLRequest class. 我正在另一个应用程序中执行此操作,但这在URLRequest类之下。 I am unsure of how low level Alomofire actually delves, but it will definitely handle everything you desire without doing anything differently. 我不确定Alomofire到底有多低沉,但是它肯定会处理您想要的一切,而无需做其他任何事情。

只需更新应用程序内的URL以使用“ https”,就可以完成。

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

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