Closed nacohen closed 4 years ago
@nacohen I think I am experiencing this issue with iOS 14 as well - can you show me how you converted it to a StateObject?
@V8tr I also experience a crash on iOS 14 when AsyncImage is embedded in a List.
Fix was a combination of nacohen's conversion to StateObject to ensure that caching worked properly, and also changing AsyncImage.swift line 29 from 'Group' to 'VStack' to avoid crashes
Hi guys, I've updated the project for iOS 14 and now using StateObject
instead of ObservedObject
. This solved the crash.
The final version of the app crashed for me under iOS14 beta and XCode beta 2 during runtime, when the loader ObservedObject in AsyncImage underwent a premature deinit() during a view update when the downloaded images began to be displayed.
The fix was to make loader an @StateObject to allow it to persist during view updates. To initialize load in AsyncImage's init() required this line of code:
_loader = StateObject(wrappedValue: ImageLoader(url: url, cache: cache))