storyloc / storymap-ios

StoryMap - Location based Stories - iOS App
MIT License
3 stars 0 forks source link

Crash Report, remove story in list view #47

Open felixboehm opened 2 years ago

felixboehm commented 2 years ago
  1. go to list view
  2. add story, any kind
  3. remove same story directly after creation in detail view

Maybe related: "Tried to create a story via the story list, uploaded an image and the app crashed after tapping confirm 😱"

Update on reproduction, also crashes on:

  1. go to list view
  2. open any story
  3. delete story
felixboehm commented 2 years ago

The issue is due to how mapView is keeping stories. When deleting a story in listView, mapView is not updating its collections in time and even without being ontop in Layout hierarchy, mapView is re-creating its collectionData and references to the deleted object.

In ListView I have experimented in using Realm data more directly, accessing the storyDataProvider directly from VC. This works fine and follows the idea to provide story data from the storyDataProvider as "single source of truth for stories". As the story data is not held anymore in the ViewModel,

I will push the example to branch feature/list-realm

Interesting example: https://stackoverflow.com/questions/40028634/creating-an-indexed-tableview-using-realm-in-swift