Not able to parse entries from the particular content model.
it’s giving me error that unresolved in the iOS SDK.
Although the same code is working fine for the android. I have tried to fetch data using the model and also from the simple methods still getting the same error.
let contentTypeClasses: [EntryDecodable.Type] = [
Library.self,
LibraryRow.self,
LibraryRowData.self,
RowDataDetails.self,
]
let client = Client(spaceId: Constants.CONTENTFUL_SPACE_ID,
environmentId: Constants.CONTENTFUL_ENVIRONMENT_ID,
accessToken: Constants.CONTENTFUL_ACCESS_TOKEN,
contentTypeClasses: contentTypeClasses)
let query = QueryOn<Library>.where(field: .libraryTitle, .equals("Library")).include(10)
client.fetchArray(of: Library.self, matching: query) { [unowned self] result in
switch result {
case .success(let arrayResponse):
guard !arrayResponse.items.isEmpty else {
print("No data found")
return
}
print(arrayResponse)
completionHandler(arrayResponse.items, nil)
case .failure(let error):
print("Oh no something went wrong: \(error)")
completionHandler(nil, error)
}
}
From the above method, I am able to get the details till the libraryRow but in libraryRow theLibraryRowData refers to the different named contentTypeID like an attached image.
I am getting the below error. whenever I try to fetch it. Also, I am not able to get assets from that.
For assets, I am trying this
libraryRowEntry.fields[“titleIcon”] as ? [Contentful.Asset]
But it’s not working.
Optional(Contentful.Link.asset(Contentful.Asset))
[Contentful.Link.unresolved(Contentful.Link.Sys(id: “XozGKbG9ofDcAlKYNWXCa”, linkType: “Entry”, type: “Link”)), Contentful.Link.unresolved(Contentful.Link.Sys(id: “6kv4dVKCFmapdzuZOSEO5l”, linkType: “Entry”, type: “Link”)), Contentful.Link.unresolved(Contentful.Link.Sys(id: “5BlYij7wcHxSPSqNkw6qmJ”, linkType: “Entry”, type: “Link”))]
I have followed the below documents for the integration.
Also the git example.
https://github.com/contentful/the-example-app.swift