Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App crashes on iOS 14.4.1 #3247

Closed
matijakregarGH opened this issue Oct 2, 2023 · 6 comments
Closed

App crashes on iOS 14.4.1 #3247

matijakregarGH opened this issue Oct 2, 2023 · 6 comments
Assignees
Labels
bug Generally incorrect behavior needs investigation planned-next Slated to be included in the next release

Comments

@matijakregarGH
Copy link

matijakregarGH commented Oct 2, 2023

Summary

On iOS 14.4.1 I'm getting the following exception when running my app
SIGABRT: Could not cast value of type 'Swift.AnyHashable' (0x...) to 'Swift.String' (0x...).
when accessing the key subscript in the DataDict (line 55 _data[key] as! T).

This is not the first query that is loaded, but it is a first one that has a more complex structure including fragments and also probably the first query that has an optional property with nil assigned .

The value linked to the key is of type String? and the actual value is nil.

The same app loading the same data does not crash on iOS 16.6.1 and iOS 17.0.2.

Version

1.5.0

Steps to reproduce the behavior

I have tried to replicate the issue in a demo project, but couldn't do so using the mocking option.

If you can point me in the right direction on how to write a test with loading a JSON file, I'm happy to provide a demo project that replicates the behaviour.

Sorry for not providing more relevant info at the moment.

Logs

No response

Anything else?

Reverting Apollo to 1.4.0 "solves" the issue.

@matijakregarGH matijakregarGH added bug Generally incorrect behavior needs investigation labels Oct 2, 2023
@jozefb
Copy link

jozefb commented Oct 3, 2023

We have found same issue (we are using version 1.5.2 and iOS 14.4 (18D46)). Based on the investigation, issue is probably related with some change in JSONResponseParsingInterceptor.swift where any optional field queried by a client that has a value of Swift.AnyHashable(<null>) in the parsed JSON, is represented by Swift.AnyHashable(nil) in the parsed GraphQLResponse DataDict.
In older versions, such fields are not present at all in the parsed GraphQLResponse DataDict

@calvincestari
Copy link
Member

Thanks for the issue reports, we'll take a look into this asap.

@AnthonyMDev AnthonyMDev added the planned-next Slated to be included in the next release label Oct 3, 2023
@AnthonyMDev AnthonyMDev added this to the Patch Releases (1.x.x) milestone Oct 3, 2023
@AnthonyMDev
Copy link
Contributor

Update: I've got a fix for this figured out. I just need to do some clean up of the code and tests to get the PR packaged up nicely. Ran out of time for tonight, but I'll get this finished up tomorrow and a PR in.

We are going to include this in the 1.6.0 release that is coming at the end of the week!

@AnthonyMDev
Copy link
Contributor

I've got a PR for the fix up now here.

@BobaFetters
Copy link
Member

Closed by: apollographql/apollo-ios-dev#61

@AnthonyMDev
Copy link
Contributor

There was a minor mistake in that PR. This is now fixed by: apollographql/apollo-ios-dev#68. We'll be putting out a 1.6.1 patch to correct this shortly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Generally incorrect behavior needs investigation planned-next Slated to be included in the next release
Projects
None yet
Development

No branches or pull requests

5 participants