Use of undeclared type 'JSON' and use of unresolved identifier 'JSONEncoding'

て烟熏妆下的殇ゞ 提交于 2019-12-10 22:37:39

问题


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.

here's and import example

and an error example

Any help to solve this issue would be greatly appreciated

here are more examples from different swift files

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

this one is for use of undeclared type 'JSON'


回答1:


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

and Replace JSON? to JSON
that it..

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) }



来源:https://stackoverflow.com/questions/41757877/use-of-undeclared-type-json-and-use-of-unresolved-identifier-jsonencoding

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!