//Reading data from Local Json file instead of Service urls using Alamofire in swift3
func getwordmeaningdata()
{
if let path = Bundle.main.path(forResource: "localfile", ofType: "json") {
let url=URL(fileURLWithPath: path)
Alamofire.request(url).responseJSON { response in
if let JSON = response.result.value {
print("JSON: \(JSON)")
}
}
}//This is the data of local json file not getting from URL
localfile.json
{
"person":[
{
"name": "Bob"
},
{
"name": "Vinny"
}
]
}
its fine, but status code is always nil.. Do you know the reason?
ReplyDelete