iphone - AlamofireNetworkActivityIndi​​cator 不工作

标签 iphone json swift alamofire activity-indicator

我在我的项目中通过 pod 集成了 AlamofireSwiftyJsonAlamofireNetworkActivityIndi​​cator 框架。按照 Github 页面中给出的说明操作后,AlamofireNetworkActivityIndi​​cator 未显示。 https://github.com/Alamofire/AlamofireNetworkActivityIndicator

它表示事件指示器工作所需的全部是以下代码行:

NetworkActivityIndicatorManager.shared.isEnabled = true

我基本上只需要一个事件指示器来显示何时发出请求或正在加载数据(Alamofire 方法)

最佳答案

其实你误会了 AlamofireNetworkActivityIndi​​cator 并不是像 MBProgressHUDSVProgressHUD 这样的 UIActivityIndi​​cator。当有 API 调用时,它会在状态栏中显示一个微调框。

这将用于显示 NetworkActivityIndi​​catorManager.shared.isEnabled = truefalse 将从状态栏中隐藏。

//Using MBProgressHUD
//Show indicator 
MBProgressHUD.showHUDAddedTo(self.view, animated: true)
Alamofire.request(.POST, URL, parameters: parameter, encoding: .JSON)
 .responseJSON { response in
 //Hide indicator
MBProgressHUD.hideAllHUDsForView(self.view, animated: true)
}

关于iphone - AlamofireNetworkActivityIndi​​cator 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41711658/

相关文章:

iphone - 如何在雪豹上安装iPhone2.0 SDK?

iphone - 代码可以在模拟器上运行,但不能在 iPhone 上运行?

java - spring jdbcTemplate 是否会删除 URL?

iphone - 我可以使用 UITextFields 中的用户名和密码信息自动登录到 UIWebView 中的网站吗?

iphone - 我应该估计这个 iPad 应用程序需要多少工时?

java - JSONObject 到 Java 表示

javascript - 需要来自 JSON 的不带引号的值

swift - 在 swift 应用程序开发中使用未声明的类型

xcode - UIWebView ... 需要什么 HTML 格式?

ios - 在位置访问权限中按下允许按钮后如何执行操作?