使用未声明的类型'JSON'和未解析的标识符'JSONEncoding' [英] Use of undeclared type 'JSON' and use of unresolved identifier 'JSONEncoding'

查看:90
本文介绍了使用未声明的类型'JSON'和未解析的标识符'JSONEncoding'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Xcode 8.2项目(Swift 3)中每个需要JSON或JSONEncoding的文件都出现上述错误.我已经在pod文件中包含SwiftyJSON并将其导入这些文件中.我已经将其添加到依赖项和链接列表中.

I am having the above error on every file in my Xcode 8.2 project (swift 3) that require JSON or JSONEncoding. I already have SwiftyJSON in my pod files and imported it in those files. I already added it in the list of dependancies and links.

这是导入示例

和错误示例

任何解决此问题的帮助将不胜感激

Any help to solve this issue would be greatly appreciated

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

here are more examples from different swift files

此错误显示无法推断'arrFeeds的类型"

this errors says 'Could not infer type for 'arrFeeds''

这是用于使用未声明的类型'JSON'

this one is for use of undeclared type 'JSON'

推荐答案

那很容易. 只需执行并运行...
import Alamofire
import SwiftyJSON

that is Easy. just do this and Run it...
import Alamofire
import SwiftyJSON

和 将JSON?替换为JSON
那..

and Replace JSON? to JSON
that it..

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

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

这篇关于使用未声明的类型'JSON'和未解析的标识符'JSONEncoding'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆