【问题标题】:can't call Alamofire.request(...)不能调用 Alamofire.request(...)
【发布时间】:2018-02-07 06:03:26
【问题描述】:

这是我的 Pod 文件...

# Uncomment the next line to define a global platform for your project
platform :ios, '11.2'

target 'Karaweik' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!
pod 'Alamofire'
  # Pods for Karaweik

end

我只接到电话 AlamofireVersionNumber:

【问题讨论】:

  • 这很正常(不应该发生),但只需输入 Alamofire 请求的完整代码即可。
  • @la-win-ko : 你能做的最好的事情是在编写 import 语句之后清理并构建项目一次,以使导入的库可用于项目
  • @sharadchauhan,你是对的

标签: ios swift alamofire


【解决方案1】:

这是关于这个库的一个问题,但如果你添加所需的代码,它就会起作用。为 Alamofire 添加此代码并运行:

Alamofire.request("http://api.androidhive.info/contacts/").responseData { (response) -> Void in

       let responseJson = String(data : response.result.value!, encoding : String.Encoding.utf8)
       print(responseJson)
 }

【讨论】:

    猜你喜欢
    • 2017-03-18
    • 2017-06-01
    • 1970-01-01
    • 2019-12-12
    • 2015-07-29
    • 1970-01-01
    • 1970-01-01
    • 2018-03-22
    • 1970-01-01
    相关资源
    最近更新 更多