Support Topics Documentation Slack YouTube Blog

Unable to cast to Class

Hi,

I have been notified that our app is crashing. When I run the app in Xcode, I get the casting error
“Could not cast value of type ‘Swift._SwiftDeferredNSDictionary<Swift.String, Any>’”.

Below is the call from the app to the server, which ends up “nil” after the optional cast.

image

When I force cast it in the debugger, I get the above error.

This is unchanged code for since early January. Here is the class I am attempting to cast into:
image

And here is the JSON Array I am getting back prior to casting.

I see the correct data from the server response, so I know it is retrieving, but it seems to fail when casting.

Any ideas?

Thanks,

Mark Moline

I’ve walked through more places in my code and I find that all of my castings are failing. As I said, this code was last released into the store in January, was functioning in testing at that time, and worked into February before starting to fail. Any help would be appreciated

One more note. I was at 6.2.1 for the cocoapod and just upgraded to 6.2.10. It did not change anything.

Additional information: Android calls continue to work without issue. Only iOS appears to have a casting problem.

We are having the exact same problem, the app no longer works on iOS, zero code changes our side.

Hi guys,

We are investigating the issue.

Regards,
Mark

@Mark_Moline and @Reece_Smith ,

Are the objects coming directly from the database or perhaps through an API service?

Regards,
Mark

We have a custom service API that looks like this

which sends back this object


image

Also custom API service for us.

@Mark_Moline @Reece_Smith we have deployed a patch for the server, could you check if it works for you?

Looks like it’s working. thank you!