在针对iOS 7的项目中导入Alamofire

编程入门 行业动态 更新时间:2024-10-26 14:38:57
本文介绍了在针对iOS 7的项目中导入Alamofire的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我检查了新的Alamofire安装步骤。

I checked the new Alamofire installation steps.

由于我需要定位iOS 7.0,所以我想知道是否导入 Alamofire.swift 是否足以使其正常工作?

Since I need to target iOS 7.0 I wonder if importing the Alamofire.swift is enough to make it works or not?

为什么文档指出将功能包装在 Struct Alamofire ?需要像在命名空间中那样调用函数吗?在那种情况下,我可以包装整个文件还是单个功能?

Why the documentation states to wrap the functions around a Struct Alamofire? is that needed to call functions as they were within a Namespace? and in that case have I to wrap the whole file or single functions?

推荐答案

您只需添加以下内容:

//put this on alamofire.swift, then call it as Alamofire.manager.your_method struct Alamofire { static let manager = Manager.sharedInstance }

然后您可以按以下方式使用:

And after you can use on this way:

Alamofire.manager.request(.GET, videoUrl, parameters: ["foo": "bar"]) .response { (request, response, data, error) in println(request) println(response) println(error) }

更多推荐

在针对iOS 7的项目中导入Alamofire

本文发布于:2023-11-26 03:21:34,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1632429.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:项目   iOS   Alamofire

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!