iOS: Crash on iOS 14 with null value in Fragment

We have a generated Fragment subclass that has an optional String property generated as such:

var name: String? {
  get { __data["name"] }
  set { __data["name"] = newValue }
}

It crashes on the get accessor which calls the generic subscript accessor on Apollo’s DataDict which force casts to the type (String?), but an underlying nil value causes a crash on iOS 14. It seems to work fine on later versions of iOS.

The crash reports the error is Could not cast value of type 'Swift.AnyHashable' to 'Swift.String'

Any idea how we could avoid this crashing? We don’t really want to have to drop support for iOS 14.

TIA!

@Ian_L Thanks for the report! We have an open issue for this on our GitHub that is being tracked and worked on you can follow along there for updates on the issue. App crashes on iOS 14.4.1 · Issue #3247 · apollographql/apollo-ios · GitHub

1 Like

Ah amazing, thanks for pointing me to that @ZachF-Apollo! Sounds like you’re on top of it, so thanks also for the prompt attention.