使用未申报的类型' JSON'并使用未解析的标识符' JSONEncoding'

时间:2017-01-20 07:04:12

标签: json swift3 swifty-json

我在Xcode 8.2项目(swift 3)中需要JSON或JSONEncoding的每个文件上都有上述错误。我已经在我的pod文件中安装了SwiftyJSON并将其导入这些文件中。我已将其添加到依赖项和链接列表中。

Target Dependancies

link binary

这里和导入示例

enter image description here

和错误示例

enter image description here

非常感谢任何有助于解决此问题的帮助

这里有来自不同swift文件的更多示例

此错误表示“无法推断出#arrFeeds''

这个是使用未申报的类型' JSON' enter image description here

1 个答案:

答案 0 :(得分:3)

很容易。 只是这样做并运行它...
import Alamofire
import SwiftyJSON

和 将JSON?替换为JSON
它... ..

试试这个 if responseObject.result.isSuccess { let resJson = JSON(responseObject.result.value!) success(resJson) } if responseObject.result.isFailure { let error : Error = responseObject.result.error! failure(error) }