Type 'String?' does not conform to protocol 'ExpressibleByStringLiteral'
RamandeepGosal opened this issue · comments
Well Hi,
I am having a problem in this code ->
let provider = MoyaProvider<APIType>(endpointClosure: APIProviderClosure, plugins: [NetworkLoggerPlugin(verbose: true)])
provider.request(APIType.categories()) { (result) in
if case .success(let response) = result {
do {
let activity = try response.mapObject(withKeyPath: "data.activities")
Logger.log(msgTitle: "categories COUNT-->", msg: activity)
} catch MoyaError.jsonMapping(let error) {
Logger.log(msgTitle: "ERROR-->", msg: error)
} catch {
print(":(")
}
}
}
Here When I am trying mapObject or mapArray It shows the error
Type 'String?' does not conform to protocol 'ExpressibleByStringLiteral'
But it works with mapString
Can you please let me know the issue?
Using XCode 8.3.1
no objectMapper installed
Hey @RamandeepGosal. It seems like you didn't provide a type you are trying to map to. In the newest 5.0.0 version it is more verbose that you need to provide a type so the compiler knows what you are trying to map. Please read the README.md and see all the changes. If it doesn't help, please create a new issue with your JSON payload & mapper model you are trying to map to.
Cheers!
Thanks for the update @sunshinejr. I'll definitely look in to it.